Documentation ¶
Index ¶
- Variables
- func BucketExists(tx *bolt.Tx, path []string) (bool, error)
- func CreateBucket(tx *bolt.Tx, path []string) (*bolt.Bucket, error)
- func Delete(ctx context.Context, tx *bolt.Tx, path []string, key string) error
- func DeleteBucket(tx *bolt.Tx, path []string) error
- func DeleteKey(tx *bolt.Tx, path []string, key string) error
- func Get[T any, M Message[T]](ctx context.Context, tx *bolt.Tx, path []string, key string) (M, error)
- func GetKey(tx *bolt.Tx, path []string, key string) ([]byte, error)
- func KeyExists(tx *bolt.Tx, path []string, key string) (bool, error)
- func List[T any, M Message[T]](ctx context.Context, tx *bolt.Tx, path []string, page *dsc.PaginationRequest) ([]M, *dsc.PaginationResponse, 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 []string, filter string) ([]M, error)
- func Set[T any, M Message[T]](ctx context.Context, tx *bolt.Tx, path []string, key string, t M) (M, error)
- func SetBucket(tx *bolt.Tx, path []string) (*bolt.Bucket, error)
- func SetFieldProperty[T any](target *T, fieldName string, value interface{}) error
- func SetKey(tx *bolt.Tx, path []string, 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 DirectoryType
- type IdentifierType
- type KVIterator
- type KVIteratorOption
- type Message
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.
View Source
var ( SystemPath = []string{"_system"} ObjectTypesPath = []string{"object_types"} PermissionsPath = []string{"permissions"} RelationTypesPath = []string{"relation_types"} ObjectsPath = []string{"objects"} RelationsSubPath = []string{"relations_sub"} RelationsObjPath = []string{"relations_obj"} )
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 DirectoryType ¶
type DirectoryType interface { *dsc.Object | *dsc.Relation | *dsc.ObjectType | *dsc.RelationType | *dsc.Permission proto.Message }
type IdentifierType ¶
type IdentifierType interface { *dsc.ObjectIdentifier | *dsc.RelationIdentifier | *dsc.ObjectTypeIdentifier | *dsc.RelationTypeIdentifier | *dsc.PermissionIdentifier proto.Message }
type KVIterator ¶
type KVIterator struct {
// contains filtered or unexported fields
}
KVIterator - key-value iterator.
func NewKVIterator ¶
func NewKVIterator(tx *bolt.Tx, path []string, opts ...KVIteratorOption) (*KVIterator, error)
func (*KVIterator) Error ¶
func (i *KVIterator) Error() error
func (*KVIterator) Key ¶
func (i *KVIterator) Key() []byte
func (*KVIterator) Next ¶
func (i *KVIterator) Next() bool
func (*KVIterator) Value ¶
func (i *KVIterator) Value() []byte
type KVIteratorOption ¶
type KVIteratorOption func(*KVIterator)
func WithPrefix ¶
func WithPrefix(prefix string) KVIteratorOption
Click to show internal directories.
Click to hide internal directories.