user

package
v0.27.4 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2025 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
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 */

)
View Source
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 New

func New(opts ...EngineOpt) (*Engine, error)

New creates and returns a Vela service for integrating with users in the database.

func (*Engine) CountUsers added in v0.27.0

func (e *Engine) CountUsers(ctx context.Context) (int64, error)

CountUsers gets the count of all users from the database.

func (*Engine) CreateUser added in v0.27.0

func (e *Engine) CreateUser(ctx context.Context, u *api.User) (*api.User, error)

CreateUser creates a new user in the database.

func (*Engine) CreateUserIndexes added in v0.27.0

func (e *Engine) CreateUserIndexes(ctx context.Context) error

CreateUserIndexes creates the indexes for the users table in the database.

func (*Engine) CreateUserTable added in v0.27.0

func (e *Engine) CreateUserTable(ctx context.Context, driver string) error

CreateUserTable creates the users table in the database.

func (*Engine) DeleteUser added in v0.27.0

func (e *Engine) DeleteUser(ctx context.Context, u *api.User) error

DeleteUser deletes an existing user from the database.

func (*Engine) GetUser added in v0.27.0

func (e *Engine) GetUser(ctx context.Context, id int64) (*api.User, error)

GetUser gets a user by ID from the database.

func (*Engine) GetUserForName added in v0.27.0

func (e *Engine) GetUserForName(ctx context.Context, name string) (*api.User, error)

GetUserForName gets a user by name from the database.

func (*Engine) ListLiteUsers added in v0.27.0

func (e *Engine) ListLiteUsers(ctx context.Context, page, perPage int) ([]*api.User, error)

ListLiteUsers gets a lite (only: id, name) list of users from the database.

func (*Engine) ListUsers added in v0.27.0

func (e *Engine) ListUsers(ctx context.Context) ([]*api.User, error)

ListUsers gets a list of all users from the database.

func (*Engine) UpdateUser added in v0.27.0

func (e *Engine) UpdateUser(ctx context.Context, u *api.User) (*api.User, error)

UpdateUser updates an existing user in the database.

type EngineOpt

type EngineOpt func(*Engine) error

EngineOpt represents a configuration option to initialize the database engine for Users.

func WithClient

func WithClient(client *gorm.DB) EngineOpt

WithClient sets the gorm.io/gorm client in the database engine for Users.

func WithContext added in v0.21.0

func WithContext(ctx context.Context) EngineOpt

WithContext sets the context in the database engine for Users.

func WithEncryptionKey

func WithEncryptionKey(key string) EngineOpt

WithEncryptionKey sets the encryption key in the database engine for Users.

func WithLogger

func WithLogger(logger *logrus.Entry) EngineOpt

WithLogger sets the github.com/sirupsen/logrus logger in the database engine for Users.

func WithSkipCreation

func WithSkipCreation(skipCreation bool) EngineOpt

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)
}

Jump to

Keyboard shortcuts

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