store

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrGetUserQuery       = errors.New("error getting user")
	ErrUserNotFound       = errors.New("user not found")
	ErrCouldNotCreateUser = errors.New("could not create user")
)

Functions

This section is empty.

Types

type Config

type Config struct {
	User     string `yaml:"user"`
	Password string `yaml:"password"`
	Name     string `yaml:"name"`
	Host     string `yaml:"host"`
	Port     string `yaml:"port"`
}

func (Config) Validate

func (config Config) Validate() error

type PostgresStore

type PostgresStore struct {
	*sql.DB
	// contains filtered or unexported fields
}

func NewPostgresStore

func NewPostgresStore(logger zerolog.Logger, cfg *Config) (*PostgresStore, error)

func (*PostgresStore) CreateUser

func (s *PostgresStore) CreateUser(ctx context.Context, user *types.User) error

func (*PostgresStore) GetUser

func (s *PostgresStore) GetUser(ctx context.Context, id string) (*types.User, error)

type Store

type Store interface {
	GetUser(ctx context.Context, id string) (*types.User, error)
	CreateUser(ctx context.Context, user *types.User) error
}

Jump to

Keyboard shortcuts

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