mongodb

package
v0.0.0-...-ab5ebe4 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2022 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewMongoDB

func NewMongoDB(ctx context.Context, config Config) (*mongo.Client, error)

Types

type Category

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

func NewCategory

func NewCategory(collection *mongo.Collection) *Category

func (*Category) Add

func (c *Category) Add(ctx context.Context, telegramChatID int64, name string) error

func (*Category) AddToBeRenamedToCategory

func (c *Category) AddToBeRenamedToCategory(ctx context.Context, telegramChatID int64, name string) error

func (*Category) List

func (c *Category) List(ctx context.Context, telegramChatID int64) ([]core.Category, error)

func (*Category) Remove

func (c *Category) Remove(ctx context.Context, telegramChatID int64, name string) error

func (*Category) Rename

func (c *Category) Rename(ctx context.Context, telegramChatID int64, newName string) error

type Config

type Config struct {
	Scheme   string
	Host     string
	Username string
	Password string
}

type Interaction

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

func NewInteraction

func NewInteraction(collection *mongo.Collection) *Interaction

func (*Interaction) Add

func (i *Interaction) Add(ctx context.Context, telegramChatID int64, interactionID int) error

func (*Interaction) Get

func (i *Interaction) Get(ctx context.Context, telegramChatID int64) (int, error)

func (*Interaction) Remove

func (i *Interaction) Remove(ctx context.Context, telegramChatID int64) error

type Note

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

func NewNote

func NewNote(collection *mongo.Collection) *Note

func (*Note) Add

func (n *Note) Add(ctx context.Context, telegramChatID int64, categoryName, content string) error

func (*Note) ListInCategory

func (n *Note) ListInCategory(
	ctx context.Context,
	telegramChatID int64,
	categoryName string,
) ([]core.Note, error)

func (*Note) Remove

func (n *Note) Remove(ctx context.Context, telegramChatID int64, categoryName, content string) error

type User

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

func NewUser

func NewUser(collection *mongo.Collection) *User

func (*User) CheckChatIDExists

func (u *User) CheckChatIDExists(ctx context.Context, telegramChatID int64) error

func (*User) CreateIfNotExists

func (u *User) CreateIfNotExists(ctx context.Context, telegramChatID int64) error

Jump to

Keyboard shortcuts

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