mongo

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2022 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 MongoDB

type MongoDB struct {
	Client   *mongo.Client
	Database *mongo.Database
}

func New

func New() *MongoDB

func (*MongoDB) Close

func (m *MongoDB) Close() error

func (*MongoDB) Connect

func (m *MongoDB) Connect(uri, database string) error

func (*MongoDB) GetSessionByID

func (m *MongoDB) GetSessionByID(id string) (*Session, error)

func (*MongoDB) GetUserByID

func (m *MongoDB) GetUserByID(id string) (*User, error)

func (*MongoDB) InsertSession

func (m *MongoDB) InsertSession(document Session) error

func (*MongoDB) UpsertUser

func (m *MongoDB) UpsertUser(document User) error

type Server

type Server struct {
	ID              string    `bson:"_id" json:"id"`
	Host            string    `bson:"host" json:"host"`
	Port            uint16    `bson:"port" json:"port"`
	Online          bool      `bson:"online" json:"online"`
	OnlineCount     int64     `bson:"onlineCount" json:"online_count"`
	TotalCount      int64     `bson:"totalCount" json:"total_count"`
	User            string    `bson:"user" json:"user"`
	LastStatusCheck time.Time `bson:"lastStatusCheck" json:"last_status_check"`
	CreatedAt       time.Time `bson:"createdAt" json:"created_at"`
}

type ServerEventLog

type ServerEventLog struct {
	ID        string    `bson:"_id" json:"id"`
	Server    string    `bson:"server" json:"server"`
	Type      string    `bson:"type" json:"type"`
	Timestamp time.Time `bson:"timestamp" json:"timestamp"`
}

type ServerStatusLog

type ServerStatusLog struct {
	ID            string    `bson:"_id" json:"id"`
	Server        string    `bson:"server" json:"server"`
	OnlinePlayers int64     `bson:"onlinePlayers" json:"online_players"`
	MaxPlayers    int64     `bson:"maxPlayers" json:"max_players"`
	OnlineCount   int64     `bson:"onlineCount" json:"online_count"`
	TotalCount    int64     `bson:"totalCount" json:"total_count"`
	Timestamp     time.Time `bson:"timestamp" json:"timestamp"`
}

type Session

type Session struct {
	ID   string `bson:"_id" json:"session_token"`
	User string `bson:"user" json:"user"`
}

type User

type User struct {
	ID            string    `bson:"_id" json:"id"`
	Username      string    `bson:"username" json:"username"`
	Discriminator string    `bson:"discriminator" json:"discriminator"`
	Avatar        *string   `bson:"avatar" json:"avatar"`
	AccessToken   string    `bson:"accessToken" json:"-"`
	RefreshToken  string    `bson:"refreshToken" json:"-"`
	CreatedAt     time.Time `bson:"createdAt" json:"created_at"`
}

Jump to

Keyboard shortcuts

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