user

package
v0.23.4 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2024 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 = `` /* 290-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

func New

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

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

Types

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, *library.User) (*library.User, error)
	// DeleteUser defines a function that deletes an existing user.
	DeleteUser(context.Context, *library.User) error
	// GetUser defines a function that gets a user by ID.
	GetUser(context.Context, int64) (*library.User, error)
	// GetUserForName defines a function that gets a user by name.
	GetUserForName(context.Context, string) (*library.User, error)
	// ListUsers defines a function that gets a list of all users.
	ListUsers(context.Context) ([]*library.User, error)
	// ListLiteUsers defines a function that gets a lite list of users.
	ListLiteUsers(context.Context, int, int) ([]*library.User, int64, error)
	// UpdateUser defines a function that updates an existing user.
	UpdateUser(context.Context, *library.User) (*library.User, error)
}

UserInterface represents the Vela interface for user functions with the supported Database backends.

Jump to

Keyboard shortcuts

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