badger

package
v0.7.12 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 30, 2024 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultCacheSize int64 = 100 << 20 // 100 MB
	DefaultLogSize   int64 = 100 << 20 // 100 MB
)
View Source
var (
	ErrFuncExit = errors.New("function exit")
	ErrNotAllow = errors.New("not allowed")
)

Functions

func CheckAccess

func CheckAccess(perm *data.Permission, pathRequest, method string) bool

func OpenAndRestore added in v0.7.11

func OpenAndRestore(backupPath string, options badgerhold.Options) (*badgerhold.Store, error)

Types

type Badger

type Badger struct {
	// contains filtered or unexported fields
}

func New

func New(path, backupPath string, memory, flatten bool) (*Badger, error)

func (*Badger) Backup

func (b *Badger) Backup(w io.Writer, since uint64) (uint64, error)

func (*Badger) Check

func (b *Badger) Check(req data.CheckRequest) (*data.CheckResponse, error)

func (*Badger) Close

func (b *Badger) Close() error

func (*Badger) CreateLMap

func (b *Badger) CreateLMap(ctx context.Context, lmap data.LMap) error

func (*Badger) CreatePermission

func (b *Badger) CreatePermission(ctx context.Context, permission data.Permission) (string, error)

func (*Badger) CreatePermissions

func (b *Badger) CreatePermissions(ctx context.Context, permissions []data.Permission) ([]string, error)

func (*Badger) CreateRole

func (b *Badger) CreateRole(ctx context.Context, role data.Role) (string, error)

func (*Badger) CreateUser

func (b *Badger) CreateUser(ctx context.Context, user data.User) (string, error)

func (*Badger) Dashboard

func (b *Badger) Dashboard() (*data.Dashboard, error)

func (*Badger) DeleteLMap

func (b *Badger) DeleteLMap(ctx context.Context, name string) error

func (*Badger) DeletePermission

func (b *Badger) DeletePermission(ctx context.Context, id string) error

func (*Badger) DeleteRole

func (b *Badger) DeleteRole(ctx context.Context, id string) error

func (*Badger) DeleteUser

func (b *Badger) DeleteUser(ctx context.Context, id string) error

func (*Badger) ExtendRole

func (b *Badger) ExtendRole(txn *badger.Txn, addRoles bool, addPermissions bool, addTotalUsers bool, role *data.Role) (data.RoleExtended, error)

func (*Badger) GetLMap

func (b *Badger) GetLMap(name string) (*data.LMap, error)

func (*Badger) GetLMaps

func (b *Badger) GetLMaps(req data.GetLMapRequest) (*data.Response[[]data.LMap], error)

func (*Badger) GetPermission

func (b *Badger) GetPermission(id string) (*data.Permission, error)

func (*Badger) GetPermissions

func (b *Badger) GetPermissions(req data.GetPermissionRequest) (*data.Response[[]data.Permission], error)

func (*Badger) GetRole

func (b *Badger) GetRole(req data.GetRoleRequest) (*data.RoleExtended, error)

func (*Badger) GetRoleRelation

func (b *Badger) GetRoleRelation() (map[string]data.RoleRelation, error)

func (*Badger) GetRoles

func (b *Badger) GetRoles(req data.GetRoleRequest) (*data.Response[[]data.RoleExtended], error)

func (*Badger) GetUser

func (b *Badger) GetUser(req data.GetUserRequest) (*data.UserExtended, error)

func (*Badger) GetUsers

func (b *Badger) GetUsers(req data.GetUserRequest) (*data.Response[[]data.UserExtended], error)

func (*Badger) KeepPermissions added in v0.7.11

func (b *Badger) KeepPermissions(ctx context.Context, permissions map[string]struct{}) ([]data.IDName, error)

func (*Badger) LMapRoleIDs

func (b *Badger) LMapRoleIDs() *LMapCacheRoleIDs

func (*Badger) PatchPermission

func (b *Badger) PatchPermission(ctx context.Context, id string, patch data.PermissionPatch) error

func (*Badger) PatchRole

func (b *Badger) PatchRole(ctx context.Context, id string, rolePatch data.RolePatch) error

func (*Badger) PatchUser

func (b *Badger) PatchUser(ctx context.Context, id string, userPatch data.UserPatch) error

func (*Badger) PutLMap

func (b *Badger) PutLMap(ctx context.Context, lmap data.LMap) error

func (*Badger) PutPermission

func (b *Badger) PutPermission(ctx context.Context, permission data.Permission) error

func (*Badger) PutRole

func (b *Badger) PutRole(ctx context.Context, role data.Role) error

func (*Badger) PutRoleRelation

func (b *Badger) PutRoleRelation(ctx context.Context, relation map[string]data.RoleRelation) error

func (*Badger) PutUser

func (b *Badger) PutUser(ctx context.Context, user data.User) error

func (*Badger) Restore

func (b *Badger) Restore(r io.Reader) error

func (*Badger) SetCachedID

func (b *Badger) SetCachedID(aliasName []string, userID string) error

func (*Badger) TxCheckCreateLMap added in v0.7.9

func (b *Badger) TxCheckCreateLMap(ctx context.Context, txn *badger.Txn, lmapChecks []data.LMapCheckCreate) error

func (*Badger) TxCreateUser added in v0.7.9

func (b *Badger) TxCreateUser(ctx context.Context, txn *badger.Txn, user data.User) (string, error)

func (*Badger) TxGetUser added in v0.7.9

func (b *Badger) TxGetUser(txn *badger.Txn, req data.GetUserRequest) (*data.UserExtended, error)

func (*Badger) TxPutUser added in v0.7.9

func (b *Badger) TxPutUser(ctx context.Context, txn *badger.Txn, user data.User) error

func (*Badger) TxSetCachedID

func (b *Badger) TxSetCachedID(txn *badger.Txn, aliasName []string, userID string) error

func (*Badger) Update added in v0.7.9

func (b *Badger) Update(fn func(txn *badger.Txn) error) error

func (*Badger) Version

func (b *Badger) Version() uint64

type LMapCacheRoleIDs

type LMapCacheRoleIDs struct {
	// contains filtered or unexported fields
}

func NewLMapCacheRoleIDs

func NewLMapCacheRoleIDs(b *Badger) *LMapCacheRoleIDs

func (*LMapCacheRoleIDs) TxGet added in v0.7.9

func (l *LMapCacheRoleIDs) TxGet(txn *badger.Txn, names []string) ([]string, error)

type Logger

type Logger struct {
	// contains filtered or unexported fields
}

func NewLogger

func NewLogger() *Logger

func (*Logger) Debugf

func (l *Logger) Debugf(format string, v ...interface{})

func (*Logger) Errorf

func (l *Logger) Errorf(format string, v ...interface{})

func (*Logger) Infof

func (l *Logger) Infof(format string, v ...interface{})

func (*Logger) Warningf

func (l *Logger) Warningf(format string, v ...interface{})

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL