store

package
v0.0.0-...-d32eb86 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetClient

func SetClient(factory Factory)

SetClient is a function for setting the package-level client variable. It is used to initialize the client with a concrete implementation of Factory.

Types

type Factory

type Factory interface {
	Users() UserStore // Users returns an instance of UserStore for user-related data operations.
	Close() error     // Close is responsible for closing any resources used by the factory, e.g., database connections.
}

Factory is an interface that abstracts the creation of different stores. It provides methods to access different data stores and to close them.

func Client

func Client() Factory

Client is a function that returns the current instance of Factory.

type UserStore

type UserStore interface {
	Create(ctx context.Context, user *model.User, opts model.CreateOptions) error
	Update(ctx context.Context, user *model.User, opts model.UpdateOptions) error
	Delete(ctx context.Context, userId uint64, opts model.DeleteOptions) error
	// DeleteCollection(ctx context.Context, userId []uint64, opts model.DeleteOptions) error
	Get(ctx context.Context, userId uint64, opts model.GetOptions) (*model.User, error)
	GetByUsername(ctx context.Context, username string, opts model.GetOptions) (*model.User, error)
	List(ctx context.Context, opts model.ListOptions) (*model.UserList, error)
}

UserStore defines the user storage interface.

Directories

Path Synopsis
Package mock_store is a generated GoMock package.
Package mock_store is a generated GoMock package.

Jump to

Keyboard shortcuts

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