storage

package
v0.0.0-...-2717cb5 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Unknown   = Role{""}
	Guest     = Role{"guest"}
	Member    = Role{"member"}
	Moderator = Role{"moderator"}
	Admin     = Role{"admin"}
)
View Source
var (
	ErrAccountNotFound = errors.New("account not found")
)

Functions

This section is empty.

Types

type CreateAccountParams

type CreateAccountParams struct {
	Email    string `json:"email"`
	Password string `json:"password"`
}

type Dbc

type Dbc struct {
	// contains filtered or unexported fields
}

func NewDbc

func NewDbc(db *mongo.Client, config *config.Config) *Dbc

func (*Dbc) CreateAccount

func (dbc *Dbc) CreateAccount(params CreateAccountParams) (*mongo.InsertOneResult, error)

func (*Dbc) DeleteAccount

func (dbc *Dbc) DeleteAccount(id string) error

func (*Dbc) DeleteAccounts

func (dbc *Dbc) DeleteAccounts() error

func (*Dbc) GetAccountByEmail

func (dbc *Dbc) GetAccountByEmail(email string) (models.Account, error)

func (*Dbc) GetAccountCollection

func (dbc *Dbc) GetAccountCollection() *mongo.Collection

func (*Dbc) ListAccount

func (dbc *Dbc) ListAccount(id string) (models.Account, error)

func (*Dbc) ListAccounts

func (dbc *Dbc) ListAccounts() ([]*models.Account, error)

func (*Dbc) UpdateAccount

func (dbc *Dbc) UpdateAccount(account *models.Account, id string) error

type MongoDBStore

type MongoDBStore struct {
	*Dbc
	// contains filtered or unexported fields
}

type Querier

type Querier interface {
	CreateAccount(params CreateAccountParams) (*mongo.InsertOneResult, error)
	DeleteAccount(id string) error
	DeleteAccounts() error
	GetAccountByEmail(email string) (models.Account, error)
	GetAccountCollection() *mongo.Collection
	ListAccount(id string) (models.Account, error)
	ListAccounts() ([]*models.Account, error)
	UpdateAccount(account *models.Account, id string) error
}

type Role

type Role struct {
	// contains filtered or unexported fields
}

func FromString

func FromString(s string) (Role, error)

func (Role) String

func (r Role) String() string

type Store

type Store interface {
	Querier
}

func NewDBStore

func NewDBStore(client *mongo.Client, config *config.Config) Store

Jump to

Keyboard shortcuts

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