stores

package
v1.8.9 Latest Latest
Warning

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

Go to latest
Published: May 7, 2024 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AttendanceStore

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

func (*AttendanceStore) Create

func (s *AttendanceStore) Create(attendance any) error

func (*AttendanceStore) Delete

func (s *AttendanceStore) Delete(id string) error

func (*AttendanceStore) Get

func (s *AttendanceStore) Get(id string) (*mongo.Cursor, error)

func (*AttendanceStore) GetCount

func (s *AttendanceStore) GetCount(memberId string) (int, error)

func (*AttendanceStore) List

func (s *AttendanceStore) List(filter interface{}, limit int, page int) (*mongo.Cursor, error)

List retrieves a list of attendance records from the database, optionally filtered by the provided filter and limited to the specified number of records.

Parameters: - filter: An interface{} representing the filter to apply to the query. - limit: An int64 representing the maximum number of records to retrieve. If limit is 0, all records will be retrieved.

Returns: - *mongo.Cursor: A cursor to iterate over the retrieved attendance records. - error: An error if the query operation fails.

func (*AttendanceStore) Upsert

func (s *AttendanceStore) Upsert(id string, attendance any) error

type Client

type Client struct {
	*mongo.Client
	// contains filtered or unexported fields
}

func Get

func Get() *Client

func New

func New(ctx context.Context, host string, port int, username string, password string, database string) (*Client, error)

func (*Client) Connected

func (c *Client) Connected() bool

func (*Client) Disconnect

func (c *Client) Disconnect()

func (*Client) GetAttendanceStore

func (c *Client) GetAttendanceStore() (*AttendanceStore, bool)

func (*Client) GetCollection

func (c *Client) GetCollection(collection Collection) (interface{}, bool)

func (*Client) GetConfigsStore

func (c *Client) GetConfigsStore() (*ConfigsStore, bool)

func (*Client) GetMembersStore

func (c *Client) GetMembersStore() (*MembersStore, bool)

type Collection

type Collection string
const (
	MEMBERS    Collection = "members"
	CONFIGS    Collection = "configs"
	ATTENDANCE Collection = "attendance"
)

type ConfigsStore

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

func (*ConfigsStore) Create

func (s *ConfigsStore) Create(config any) error

func (*ConfigsStore) Get

func (s *ConfigsStore) Get(name string) *mongo.SingleResult

func (*ConfigsStore) Upsert

func (s *ConfigsStore) Upsert(name string, config any) error

type MembersStore

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

func (*MembersStore) Delete

func (s *MembersStore) Delete(id string) error

func (*MembersStore) Get

func (s *MembersStore) Get(id string) (*mongo.Cursor, error)

func (*MembersStore) GetRandom

func (s *MembersStore) GetRandom(max int, maxRank int) ([]map[string]interface{}, error)

func (*MembersStore) List

func (s *MembersStore) List(filter interface{}, opts ...*options.FindOptions) (*mongo.Cursor, error)

func (*MembersStore) Upsert

func (s *MembersStore) Upsert(id string, member any) error

Jump to

Keyboard shortcuts

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