user

package
v0.19.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2023 License: Apache-2.0 Imports: 6 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 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 UserService

type UserService interface {

	// CreateUserIndexes defines a function that creates the indexes for the users table.
	CreateUserIndexes() error
	// CreateUserTable defines a function that creates the users table.
	CreateUserTable(string) error

	// CountUsers defines a function that gets the count of all users.
	CountUsers() (int64, error)
	// CreateUser defines a function that creates a new user.
	CreateUser(*library.User) error
	// DeleteUser defines a function that deletes an existing user.
	DeleteUser(*library.User) error
	// GetUser defines a function that gets a user by ID.
	GetUser(int64) (*library.User, error)
	// GetUserForName defines a function that gets a user by name.
	GetUserForName(string) (*library.User, error)
	// ListUsers defines a function that gets a list of all users.
	ListUsers() ([]*library.User, error)
	// ListLiteUsers defines a function that gets a lite list of users.
	ListLiteUsers(int, int) ([]*library.User, int64, error)
	// UpdateUser defines a function that updates an existing user.
	UpdateUser(*library.User) error
}

UserService 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