HELLO
Syntax
HELLO [protover [AUTH username password] [SETNAME clientname]]
Module
connectionCategories
connection fastDescription
Switch to a different protocol, optionally authenticating and setting the connection's name. This command returns a contextual client report.
Options
protover
- The protocol version to switch to. The default is 2.AUTH username password
- Authenticate with the server using the specified username and password.SETNAME clientname
- Set the connection's name to the specified clientname.
Examples
- Go (Embedded)
- CLI
When using the embedded API, there's no need to authenticate the API caller or set an alias for the caller. Therefore, only the set protocol functionality is available in embedded mode. You can set the protocol using the SetProtocol method:
db, err := sugardb.NewSugarDB()
if err != nil {
log.Fatal(err)
}
err := db.SetProtocol(2)
The method above changes the protocol to version 3. This is relevant when executing commands using the
ExecuteCommand
method. Since this methods returns a raw RESP response. It will not affect any other methods'
return types as they return native go types.
SetProtocol
return an error if the protocol version is not supported (i.e. not 2 or 3).
Only fetch client report:
> HELLO
Authenticate and set the connection's name:
> HELLO 2 AUTH myuser mypass SETNAME myclient
Authenticate only:
> HELLO 2 AUTH myuser mypass
Set the connection's name only:
> HELLO 2 SETNAME myclient
Switch to protocol version 3:
> HELLO 3
Authenticate and switch to protocol version 3:
> HELLO 3 AUTH myuser mypass