Documentation
¶
Index ¶
- Variables
- type Auth
- type Groups
- func (s *Groups) AttachUser(ctx context.Context, params model.UserGroupParams) error
- func (s *Groups) Create(ctx context.Context, record *model.Group) error
- func (s *Groups) Delete(ctx context.Context, name string) error
- func (s *Groups) DropUser(ctx context.Context, params model.UserGroupParams) error
- func (s *Groups) List(ctx context.Context, params model.ListParams) ([]*model.Group, int64, error)
- func (s *Groups) ListUsers(ctx context.Context, params model.UserGroupParams) ([]*model.UserGroup, int64, error)
- func (s *Groups) PermitUser(ctx context.Context, params model.UserGroupParams) error
- func (s *Groups) Show(ctx context.Context, name string) (*model.Group, error)
- func (s *Groups) Update(ctx context.Context, record *model.Group) error
- func (s *Groups) ValidSort(val string) (string, bool)
- type Store
- func (s *Store) Admin(username, password, email string) error
- func (s *Store) Close() (bool, error)
- func (s *Store) Handle() *bun.DB
- func (s *Store) Info() map[string]interface{}
- func (s *Store) Migrate(ctx context.Context) (*migrate.MigrationGroup, error)
- func (s *Store) Migrator(ctx context.Context) (*migrate.Migrator, error)
- func (s *Store) Open() (bool, error)
- func (s *Store) Ping() (bool, error)
- func (s *Store) Prepare() error
- func (s *Store) Rollback(ctx context.Context) (*migrate.MigrationGroup, error)
- func (s *Store) SearchQuery(q *bun.SelectQuery, _ string) *bun.SelectQuery
- func (s *Store) WithPrincipal(principal *model.User) *Store
- type Users
- func (s *Users) AttachGroup(ctx context.Context, params model.UserGroupParams) error
- func (s *Users) CleanupRedirectTokens(ctx context.Context) error
- func (s *Users) Create(ctx context.Context, record *model.User) error
- func (s *Users) CreateRedirectToken(ctx context.Context, username string) (*model.UserToken, error)
- func (s *Users) Delete(ctx context.Context, name string) error
- func (s *Users) DeleteRedirectToken(ctx context.Context, token string) error
- func (s *Users) DropGroup(ctx context.Context, params model.UserGroupParams) error
- func (s *Users) List(ctx context.Context, params model.ListParams) ([]*model.User, int64, error)
- func (s *Users) ListGroups(ctx context.Context, params model.UserGroupParams) ([]*model.UserGroup, int64, error)
- func (s *Users) PermitGroup(ctx context.Context, params model.UserGroupParams) error
- func (s *Users) Show(ctx context.Context, name string) (*model.User, error)
- func (s *Users) ShowRedirectToken(ctx context.Context, token string) (*model.UserToken, error)
- func (s *Users) Update(ctx context.Context, record *model.User) error
- func (s *Users) ValidSort(val string) (string, bool)
Constants ¶
This section is empty.
Variables ¶
var ( // ErrWrongCredentials is returned when credentials are wrong. ErrWrongCredentials = errors.New("wrong credentials provided") // ErrAlreadyAssigned defines the error if relation is already assigned. ErrAlreadyAssigned = errors.New("user pack already exists") // ErrNotAssigned defines the error if relation is not assigned. ErrNotAssigned = errors.New("user pack is not defined") // ErrGroupNotFound is returned when a user was not found. ErrGroupNotFound = errors.New("group not found") // ErrUserNotFound is returned when a user was not found. ErrUserNotFound = errors.New("user not found") // ErrTokenNotFound is returned when a token was not found. ErrTokenNotFound = errors.New("token not found") )
var ( // ErrUnknownDriver defines a named error for unknown store drivers. ErrUnknownDriver = fmt.Errorf("unknown database driver") )
Functions ¶
This section is empty.
Types ¶
type Auth ¶
type Auth struct {
// contains filtered or unexported fields
}
Auth provides all database operations related to auth.
type Groups ¶
type Groups struct {
// contains filtered or unexported fields
}
Groups provides all database operations related to groups.
func (*Groups) AttachUser ¶
AttachUser implements the attachment of a group to an user.
func (*Groups) ListUsers ¶
func (s *Groups) ListUsers(ctx context.Context, params model.UserGroupParams) ([]*model.UserGroup, int64, error)
ListUsers implements the listing of all users for a group.
func (*Groups) PermitUser ¶
PermitUser implements the permission update for a user on a group.
type Store ¶
type Store struct {
Auth *Auth
Groups *Groups
Users *Users
// contains filtered or unexported fields
}
Store provides the general database abstraction layer.
func (*Store) SearchQuery ¶
func (s *Store) SearchQuery(q *bun.SelectQuery, _ string) *bun.SelectQuery
SearchQuery builds a query for search terms.
type Users ¶
type Users struct {
// contains filtered or unexported fields
}
Users provides all database operations related to users.
func (*Users) AttachGroup ¶
AttachGroup implements the attachment of an user to a group.
func (*Users) CleanupRedirectTokens ¶
CleanupRedirectTokens implements the cleanup of expired redirect tokens.
func (*Users) CreateRedirectToken ¶
CreateRedirectToken implements the create of a new redirect token.
func (*Users) DeleteRedirectToken ¶
DeleteRedirectToken implements the deletion of a redirect token.
func (*Users) ListGroups ¶
func (s *Users) ListGroups(ctx context.Context, params model.UserGroupParams) ([]*model.UserGroup, int64, error)
ListGroups implements the listing of all groups for an user.
func (*Users) PermitGroup ¶
PermitGroup implements the permission update for a group on an user.
func (*Users) ShowRedirectToken ¶
ShowRedirectToken implements the details for a specific redirect token.