Documentation ¶
Index ¶
- 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 string) error
- func DeleteBucket(tx *bolt.Tx, path Path) error
- func DeleteKey(tx *bolt.Tx, path Path, key string) error
- func Get[T any, M Message[T]](ctx context.Context, tx *bolt.Tx, path Path, key string) (M, error)
- func GetKey(tx *bolt.Tx, path Path, key string) ([]byte, error)
- func KeyExists(tx *bolt.Tx, path Path, key string) (bool, error)
- func Marshal[T any, M Message[T]](t M) ([]byte, error)
- func Scan[T any, M Message[T]](ctx context.Context, tx *bolt.Tx, path Path, filter string) ([]M, error)
- func Set[T any, M Message[T]](ctx context.Context, tx *bolt.Tx, path Path, key string, t M) (M, error)
- func SetBucket(tx *bolt.Tx, path Path) (*bolt.Bucket, error)
- func SetFieldProperty[T any](target *T, fieldName string, value interface{}) error
- func SetKey(tx *bolt.Tx, path Path, key string, value []byte) error
- func Unmarshal[T any, M Message[T]](b []byte) (M, error)
- func UpdateMetadata[T any, M Message[T]](ctx context.Context, tx *bolt.Tx, path []string, key string, msg *T) (M, error)
- type BoltDB
- type Config
- type Iterator
- type Message
- type PageIterator
- type PagedIterator
- type Path
- type ScanArgs
- type ScanIterator
- func (s *ScanIterator[T, M]) Delete() error
- func (s *ScanIterator[T, M]) Key() string
- func (s *ScanIterator[T, M]) Next() bool
- func (s *ScanIterator[T, M]) RawKey() []byte
- func (s *ScanIterator[T, M]) RawValue() []byte
- func (s *ScanIterator[T, M]) SetFilter(filters []func(M) bool)
- func (s *ScanIterator[T, M]) Value() M
- type ScanOption
Constants ¶
This section is empty.
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 SetFieldProperty ¶
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 Message ¶
type Message[T any] interface { proto.Message *T GetCreatedAt() *timestamppb.Timestamp }
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"} 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"} )
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]) SetFilter ¶ added in v0.21.5
func (s *ScanIterator[T, M]) SetFilter(filters []func(M) bool)
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 string) 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.