database

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const GUILD_COLLECTION = "discord_guilds"

Variables

View Source
var Client *mongo.Client

Functions

func AddSubjectToGuild added in v0.2.0

func AddSubjectToGuild(g Guild, subject string) (int64, error)

func Connect

func Connect(mongodbConfig MongodbConfig) (err error)

Types

type Guild

type Guild struct {
	ID        string        `json:"id,omitempty" bson:"_id,omitempty"`
	GuildID   string        `json:"guildId,omitempty" bson:"guildId,omitempty"`
	Name      string        `json:"name" bson:"name,omitempty"`
	Settings  GuildSettings `json:"settings" bson:"settings,omitempty"`
	ChangedAt int64         `json:"changed_at" bson:"changed_at"`
}

func GetAllGuilds

func GetAllGuilds() (guilds []Guild, err error)

func InsertGuild

func InsertGuild(g *Guild) (*Guild, error)

func NewGuild

func NewGuild(name, guildID string, s GuildSettings) *Guild

type GuildSettings

type GuildSettings struct {
	ChannelID string   `json:"channelId" bson:"channelId,omitempty"`
	Subjects  []string `json:"subjects" bson:"subjects,omitempty"`
}

type MongoCollections

type MongoCollections struct {
	Guild *mongo.Collection
}

type MongodbConfig

type MongodbConfig struct {
	Uri    string
	DbName string
}

Jump to

Keyboard shortcuts

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