Documentation ¶
Index ¶
- Constants
- func GetQueryArgsFromExprConstants(constants []*exprpb.Constant) ([]interface{}, error)
- func GetTagsFromExpression(expr *exprpb.Expr) (tags []*exprpb.Constant, exprFunction string, err error)
- type CRUD
- type Driver
- type ErrNotFound
- type KVResult
- type ListOpts
- type ListResult
- type Persister
- type Tx
Constants ¶
const ( MaxLimit = 1000 DefaultLimit = 100 DefaultOffset = 0 )
Variables ¶
This section is empty.
Functions ¶
func GetQueryArgsFromExprConstants ¶
GetQueryArgsFromExprConstants is a simple helper function to convert user-provided constant values to their string interface counterparts, which is helpful for use as placeholder values when writing DB queries. This will also filter out any duplicate tag values. An error will only be returned when a constant is not of the `exprpb.Constant_StringValue` type.
func GetTagsFromExpression ¶
func GetTagsFromExpression(expr *exprpb.Expr) (tags []*exprpb.Constant, exprFunction string, err error)
GetTagsFromExpression takes in a pre-validated CEL expression and extracts the tags to filter upon. The CEL logical operator is also returned (`operators.LogicalAnd` or `operators.LogicalOr`). As a sanity check, an error will be returned when the expression does not conform to what is expected.
Types ¶
type CRUD ¶
type CRUD interface { // Get retrieves the value from store. // It returns ErrNotFound if key is not found. Get(ctx context.Context, key string) ([]byte, error) // Put sets key to value in the store. // If key is already present, it is overwritten. Put(ctx context.Context, key string, value []byte) error // Delete deletes the key and its associated value from store. // If key is not found, an ErrNotFound error is returned. Delete(ctx context.Context, key string) error // List returns all keys with prefix. List(ctx context.Context, prefix string, opts *ListOpts) (ListResult, error) }
type ErrNotFound ¶
type ErrNotFound struct {
Key string
}
func (ErrNotFound) Error ¶
func (e ErrNotFound) Error() string
type ListOpts ¶
type ListOpts struct { // Limit is used to set the amount of results returned. Must be between zero & MaxLimit. Limit int // Offset is used for purposes of pagination. Must be a positive // number and zero is used to indicate the first page. Offset int // CEL expression used for filtering. // // When nil, no filtering of any kind will be done. When provided, the filter is // expected to be pre-validated for correctness. More specific validations can // occur later, e.g.: such validations that are specific to a particular resource. // // Read more: https://github.com/google/cel-spec Filter *exprpb.Expr }
ListOpts defines various options that affect the results returned by a `CRUD.List()` call.
func NewDefaultListOpts ¶
func NewDefaultListOpts() *ListOpts