Documentation
¶
Index ¶
- Constants
- type Engine
- func (e *Engine) CountUsers(ctx context.Context) (int64, error)
- func (e *Engine) CreateUser(ctx context.Context, u *api.User) (*api.User, error)
- func (e *Engine) CreateUserIndexes(ctx context.Context) error
- func (e *Engine) CreateUserTable(ctx context.Context, driver string) error
- func (e *Engine) DeleteUser(ctx context.Context, u *api.User) error
- func (e *Engine) GetUser(ctx context.Context, id int64) (*api.User, error)
- func (e *Engine) GetUserForName(ctx context.Context, name string) (*api.User, error)
- func (e *Engine) ListLiteUsers(ctx context.Context, page, perPage int) ([]*api.User, error)
- func (e *Engine) ListUsers(ctx context.Context) ([]*api.User, error)
- func (e *Engine) UpdateUser(ctx context.Context, u *api.User) (*api.User, error)
- type EngineOpt
- type UserInterface
Constants ¶
const ( // CreatePostgresTable represents a query to create the Postgres users table. CreatePostgresTable = `` /* 294-byte string literal not displayed */ // CreateSqliteTable represents a query to create the Sqlite users table. CreateSqliteTable = `` /* 264-byte string literal not displayed */ )
const ( // CreateUserRefreshIndex represents a query to create an // index on the users table for the refresh_token column. CreateUserRefreshIndex = ` CREATE INDEX IF NOT EXISTS users_refresh ON users (refresh_token); ` )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Engine ¶ added in v0.27.0
type Engine struct {
// contains filtered or unexported fields
}
Engine represents the user functionality that implements the UserInterface interface.
func (*Engine) CountUsers ¶ added in v0.27.0
CountUsers gets the count of all users from the database.
func (*Engine) CreateUser ¶ added in v0.27.0
CreateUser creates a new user in the database.
func (*Engine) CreateUserIndexes ¶ added in v0.27.0
CreateUserIndexes creates the indexes for the users table in the database.
func (*Engine) CreateUserTable ¶ added in v0.27.0
CreateUserTable creates the users table in the database.
func (*Engine) DeleteUser ¶ added in v0.27.0
DeleteUser deletes an existing user from the database.
func (*Engine) GetUserForName ¶ added in v0.27.0
GetUserForName gets a user by name from the database.
func (*Engine) ListLiteUsers ¶ added in v0.27.0
ListLiteUsers gets a lite (only: id, name) list of users from the database.
type EngineOpt ¶
EngineOpt represents a configuration option to initialize the database engine for Users.
func WithClient ¶
WithClient sets the gorm.io/gorm client in the database engine for Users.
func WithContext ¶ added in v0.21.0
WithContext sets the context in the database engine for Users.
func WithEncryptionKey ¶
WithEncryptionKey sets the encryption key in the database engine for Users.
func WithLogger ¶
WithLogger sets the github.com/sirupsen/logrus logger in the database engine for Users.
func WithSkipCreation ¶
WithSkipCreation sets the skip creation logic in the database engine for Users.
type UserInterface ¶ added in v0.20.0
type UserInterface interface {
// CreateUserIndexes defines a function that creates the indexes for the users table.
CreateUserIndexes(context.Context) error
// CreateUserTable defines a function that creates the users table.
CreateUserTable(context.Context, string) error
// CountUsers defines a function that gets the count of all users.
CountUsers(context.Context) (int64, error)
// CreateUser defines a function that creates a new user.
CreateUser(context.Context, *api.User) (*api.User, error)
// DeleteUser defines a function that deletes an existing user.
DeleteUser(context.Context, *api.User) error
// GetUser defines a function that gets a user by ID.
GetUser(context.Context, int64) (*api.User, error)
// GetUserForName defines a function that gets a user by name.
GetUserForName(context.Context, string) (*api.User, error)
// ListUsers defines a function that gets a list of all users.
ListUsers(context.Context) ([]*api.User, error)
// ListLiteUsers defines a function that gets a lite list of users.
ListLiteUsers(context.Context, int, int) ([]*api.User, error)
// UpdateUser defines a function that updates an existing user.
UpdateUser(context.Context, *api.User) (*api.User, error)
}