Documentation ¶
Index ¶
- Constants
- type KeyValue
- type Option
- type Options
- type ScanOption
- func MatchAny() ScanOption
- func MatchKeyLike(idx string, val string) ScanOption
- func MatchKeyValue(idx string, val string) ScanOption
- func MatchNumber(idx string, op ScanQueryOp, val float64) ScanOption
- func MatchRegex(regex string) ScanOption
- func WithLimit(limit int) ScanOption
- func WithNoLimit() ScanOption
- func WithNoTimeout() ScanOption
- func WithOffset(offset int) ScanOption
- func WithTimeout(timeout time.Duration) ScanOption
- type ScanOptions
- type ScanQuery
- type ScanQueryOp
- type ScanQueryType
- type Version
Constants ¶
const ( ScanLimitNone = 0 ScanLimitDefault = 1 ScanTimeoutNone = 0 ScanTimeoutDefault = 10 * time.Second )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Option ¶
Option is a closure that updates Options.
func WithAnyVersion ¶
func WithAnyVersion() Option
Use WithAnyVersion to update documents without caring what their version is.
func WithDestination ¶
WithDestination provides an interface for receiving data when getting a nosql.
func WithDestinationList ¶
WithDestinationList provides a interface list for receiving data when getting a nosql.
func WithMultipleSource ¶
func WithSource ¶
WithSource provides an interface to source data when updating a nosql.
func WithVersion ¶
WithVersion provides a Version value option. This is optionally used when updating documents to ensure the user has the correct version before updating.
type Options ¶
type Options struct { Version Version AnyVersion bool TTL time.Duration Source any Sources map[string]any Destination any DestinationList []any }
Options contains all the various options that the provided WithXyz functions construct.
func NewOptions ¶
NewOptions constructs an Options struct from the provided Option closures and returns it.
type ScanOption ¶
type ScanOption func(o *ScanOptions) error
func MatchKeyLike ¶
func MatchKeyLike(idx string, val string) ScanOption
MatchKeyLike packs up a keys/value search pair when scanning for a nosql - for a sql style "like" match.
func MatchKeyValue ¶
func MatchKeyValue(idx string, val string) ScanOption
MatchKeyValue packs up a keys/value search pair when scanning for a nosql.
func MatchNumber ¶
func MatchNumber(idx string, op ScanQueryOp, val float64) ScanOption
func MatchRegex ¶
func MatchRegex(regex string) ScanOption
func WithLimit ¶
func WithLimit(limit int) ScanOption
func WithNoLimit ¶
func WithNoLimit() ScanOption
func WithNoTimeout ¶
func WithNoTimeout() ScanOption
func WithOffset ¶
func WithOffset(offset int) ScanOption
For paginating query results, use in combination with an appropriate limit. NB: Offsets are not reliable in mock implementation because mock ordering is nondeterministic
func WithTimeout ¶
func WithTimeout(timeout time.Duration) ScanOption
Use WithTimeout to set the expiration time of a supported operation.
type ScanOptions ¶
func NewScanOptions ¶
func NewScanOptions(opts ...ScanOption) (options ScanOptions, err error)
NB: consider making a way to request that defaults to unlimited?
type ScanQuery ¶
type ScanQuery struct { ScanType ScanQueryType ScanOperation ScanQueryOp KeyValue KeyValue Regex string }
type ScanQueryOp ¶
type ScanQueryOp int
const ( // lower level, what operator is being used in the query? ScanOpEquals ScanQueryOp = iota ScanOpLessThan ScanOpGreaterThan )
type ScanQueryType ¶
type ScanQueryType int
const ( // high level, what kind of a scan is this query? ScanTypeUnset ScanQueryType = iota ScanTypeKeyValue ScanTypeKeyLike ScanTypeNOOP ScanTypeRegex ScanTypeNum )