Documentation ¶
Overview ¶
Package redis provides the handler function for the Redis trigger, as well as access to Redis within Spin components.
Index ¶
- func Handle(fn func(payload []byte) error)
- type Client
- func (c *Client) Del(keys ...string) (int64, error)
- func (c *Client) Execute(command string, arguments ...any) ([]*Result, error)
- func (c *Client) Get(key string) ([]byte, error)
- func (c *Client) Incr(key string) (int64, error)
- func (c *Client) Publish(channel string, payload []byte) error
- func (c *Client) Sadd(key string, values ...string) (int64, error)
- func (c *Client) Set(key string, payload []byte) error
- func (c *Client) Smembers(key string) ([]string, error)
- func (c *Client) Srem(key string, values ...string) (int64, error)
- type Result
- type ResultKind
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a Redis client.
func (*Client) Execute ¶
Execute runs the specified Redis command with the specified arguments, returning zero or more results. This is a general-purpose function which should work with any Redis command.
Arguments must be string, []byte, int, int64, or int32.
func (*Client) Get ¶
Get the value of a key. An error is returned if the value stored at key is not a string.
func (*Client) Incr ¶
Incr increments the number stored at key by one. If the key does not exist, it is set to 0 before performing the operation. An error is returned if the key contains a value of the wrong type or contains a string that can not be represented as integer.
func (*Client) Sadd ¶
Sadd adds the specified values to the set for the specified key, creating it if it does not already exist.
type Result ¶
type Result struct { Kind ResultKind Val any }
Result represents a value returned from a Redis command.
type ResultKind ¶
type ResultKind uint8
ResultKind represents a result type returned from executing a Redis command.
const ( ResultKindNil ResultKind = iota ResultKindStatus ResultKindInt64 ResultKindBinary )
func (ResultKind) GoString ¶
func (r ResultKind) GoString() string
GoString implements fmt.GoStringer.