storage

package
v0.0.0-...-4e97aa2 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2023 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MongoStore

type MongoStore struct {
	Cfg              *config.DBConfig
	Client           *mongo.Client
	GuildsCollection *mongo.Collection
	UsersCollection  *mongo.Collection
}

func NewMongoStore

func NewMongoStore(cfg *config.DBConfig) *MongoStore

func (*MongoStore) Connect

func (m *MongoStore) Connect() error

func (*MongoStore) CreateGuild

func (m *MongoStore) CreateGuild(guild *models.Guild) error

func (*MongoStore) CreateUser

func (m *MongoStore) CreateUser(user *models.User) error

func (*MongoStore) Disconnect

func (m *MongoStore) Disconnect() error

func (*MongoStore) GetGuildById

func (m *MongoStore) GetGuildById(id int) (*models.Guild, error)

func (*MongoStore) GetGuilds

func (m *MongoStore) GetGuilds() ([]*models.Guild, error)

func (*MongoStore) GetUserById

func (m *MongoStore) GetUserById(id int) (*models.User, error)

func (*MongoStore) GetUsers

func (m *MongoStore) GetUsers() ([]*models.User, error)

func (*MongoStore) UpdateGuild

func (m *MongoStore) UpdateGuild(guild *models.Guild) error

func (*MongoStore) UpdateUser

func (m *MongoStore) UpdateUser(user *models.User) error

type Storage

type Storage interface {
	Connect() error
	Disconnect() error

	GetGuilds() ([]*models.Guild, error)
	GetGuildById(id int) (*models.Guild, error)
	GetUsers() ([]*models.User, error)
	GetUserById(id int) (*models.User, error)

	CreateGuild(guild *models.Guild) error
	CreateUser(user *models.User) error

	UpdateGuild(guild *models.Guild) error
	UpdateUser(user *models.User) error
}

Jump to

Keyboard shortcuts

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