Documentation ¶
Index ¶
- Constants
- Variables
- func BucketExists(tx *bolt.Tx, path Path) (bool, error)
- func CreateBucket(tx *bolt.Tx, path Path) (*bolt.Bucket, error)
- func Delete(ctx context.Context, tx *bolt.Tx, path Path, key []byte) error
- func DeleteBucket(tx *bolt.Tx, path Path) error
- func DeleteKey(tx *bolt.Tx, path Path, key []byte) error
- func Get[T any, M Message[T]](ctx context.Context, tx *bolt.Tx, path Path, key []byte) (M, error)
- func GetAny[T any](ctx context.Context, tx *bolt.Tx, path Path, key []byte) (*T, error)
- func GetKey(tx *bolt.Tx, path Path, key []byte) ([]byte, error)
- func KeyExists(tx *bolt.Tx, path Path, key []byte) (bool, error)
- func KeyPrefixExists[T any, M Message[T]](ctx context.Context, tx *bolt.Tx, path Path, keyFilter []byte) (bool, error)
- func List[T any, M Message[T]](ctx context.Context, tx *bolt.Tx, path Path) ([]M, error)
- func ListBuckets(tx *bolt.Tx, path Path) ([]string, error)
- func Scan[T any, M Message[T]](ctx context.Context, tx *bolt.Tx, path Path, keyFilter []byte) ([]M, error)
- func ScanWithFilter(ctx context.Context, tx *bolt.Tx, path Path, keyFilter []byte, ...) error
- func Set[T any, M Message[T]](ctx context.Context, tx *bolt.Tx, path Path, key []byte, t M) (M, error)
- func SetAny[T any](ctx context.Context, tx *bolt.Tx, path Path, key []byte, t *T) (*T, error)
- func SetBucket(tx *bolt.Tx, path Path) (*bolt.Bucket, error)
- func SetKey(tx *bolt.Tx, path Path, key, value []byte) error
- type BoltDB
- type Config
- type Iterator
- type Message
- type PageIterator
- type PagedIterator
- type Path
- type ScanArgs
- type ScanIterator
- type ScanOption
Constants ¶
View Source
const ( ManifestName string = "default" ManifestVersion string = "0.0.1" )
Variables ¶
View Source
var ( ErrPathNotFound = cerr.NewAsertoError("E20050", codes.NotFound, http.StatusNotFound, "path not found") ErrKeyNotFound = cerr.NewAsertoError("E20051", codes.NotFound, http.StatusNotFound, "key not found") ErrKeyExists = cerr.NewAsertoError("E20052", codes.AlreadyExists, http.StatusConflict, "key already exists") ErrMultipleResults = cerr.NewAsertoError("E20053", codes.FailedPrecondition, http.StatusExpectationFailed, "multiple results for singleton request") )
Error codes returned by failures to parse an expression.
Functions ¶
func BucketExists ¶
BucketExists, check if bucket path exists.
func CreateBucket ¶
CreateBucket, create bucket path if not exists.
func DeleteBucket ¶
DeleteBucket, delete tail bucket of path provided.
func DeleteKey ¶
DeleteKey, delete key and value in path specified bucket, when it exists. None existing keys will not raise an error.
func KeyPrefixExists ¶ added in v0.33.1
func ListBuckets ¶ added in v0.30.0
ListBuckets, returns the bucket name underneath the path.
func ScanWithFilter ¶ added in v0.33.1
func ScanWithFilter( ctx context.Context, tx *bolt.Tx, path Path, keyFilter []byte, valueFilter func(*dsc3.RelationIdentifier) bool, pool graph.RelationPool, out *[]*dsc3.RelationIdentifier, ) error
Types ¶
type BoltDB ¶
type BoltDB struct {
// contains filtered or unexported fields
}
BoltDB based key-value store.
type Iterator ¶ added in v0.21.5
type Iterator[T any, M Message[T]] interface { Next() bool // move cursor to next element. RawKey() []byte // return raw key value ([]byte). RawValue() []byte // return ram value value ([]byte). Key() string // return key value (string). Value() M // return typed value (M). Delete() error // delete element underneath cursor. }
type PageIterator ¶ added in v0.21.5
func (*PageIterator[T, M]) Next ¶ added in v0.21.5
func (p *PageIterator[T, M]) Next() bool
func (*PageIterator[T, M]) NextToken ¶ added in v0.21.5
func (p *PageIterator[T, M]) NextToken() string
func (*PageIterator[T, M]) Value ¶ added in v0.21.5
func (p *PageIterator[T, M]) Value() []M
type PagedIterator ¶ added in v0.21.5
func NewPageIterator ¶ added in v0.21.5
func NewPageIterator[T any, M Message[T]](ctx context.Context, tx *bolt.Tx, path Path, opts ...ScanOption) (PagedIterator[T, M], error)
type Path ¶ added in v0.21.5
type Path []string
var ( SystemPath Path = []string{"_system"} ManifestPath Path = []string{"_manifest", ManifestName, ManifestVersion} ObjectTypesPath Path = []string{"object_types"} PermissionsPath Path = []string{"permissions"} RelationTypesPath Path = []string{"relation_types"} ObjectsPath Path = []string{"objects"} RelationsSubPath Path = []string{"relations_sub"} RelationsObjPath Path = []string{"relations_obj"} MetadataKey = []byte("metadata") BodyKey = []byte("body") ModelKey = []byte("model") )
type ScanIterator ¶ added in v0.21.5
func (*ScanIterator[T, M]) Delete ¶ added in v0.21.5
func (s *ScanIterator[T, M]) Delete() error
func (*ScanIterator[T, M]) Key ¶ added in v0.21.5
func (s *ScanIterator[T, M]) Key() string
func (*ScanIterator[T, M]) Next ¶ added in v0.21.5
func (s *ScanIterator[T, M]) Next() bool
func (*ScanIterator[T, M]) RawKey ¶ added in v0.21.5
func (s *ScanIterator[T, M]) RawKey() []byte
func (*ScanIterator[T, M]) RawValue ¶ added in v0.21.5
func (s *ScanIterator[T, M]) RawValue() []byte
func (*ScanIterator[T, M]) Value ¶ added in v0.21.5
func (s *ScanIterator[T, M]) Value() M
type ScanOption ¶ added in v0.21.5
type ScanOption func(*ScanArgs)
func WithKeyFilter ¶ added in v0.21.5
func WithKeyFilter(filter []byte) ScanOption
func WithPageSize ¶ added in v0.21.5
func WithPageSize(size int32) ScanOption
func WithPageToken ¶ added in v0.21.5
func WithPageToken(token string) ScanOption
Click to show internal directories.
Click to hide internal directories.