Documentation
¶
Overview ¶
Code generated by github.com/dashotv/golem. DO NOT EDIT.
Code generated by github.com/dashotv/golem. DO NOT EDIT.
Index ¶
- func QueryBool(c echo.Context, name string) bool
- func QueryDefaultInteger(c echo.Context, name string, def int) (int, error)
- func QueryInt(c echo.Context, name string) int
- func QueryString(c echo.Context, name string) string
- func Setup() error
- func Start() error
- func WithTimeout(delegate func() interface{}, timeout time.Duration) (ret interface{}, ok bool)
- type Application
- type Bot
- type Channels
- type Config
- type Connection
- type ConnectionSet
- type Connector
- func (c *Connector) ChannelsByChannelID(channel_id string) (*Channels, error)
- func (c *Connector) ChannelsCreateUpdate(channel_id, channel_name, guild_id string) error
- func (c *Connector) ChannelsDelete(channel_id string) error
- func (c *Connector) ChannelsGet(id string) (*Channels, error)
- func (c *Connector) ChannelsList(guildID string) ([]*Channels, error)
- func (c *Connector) WatchesByUserID(user_id string) (*Watches, error)
- func (c *Connector) WatchesGame(user_id, game string) error
- func (c *Connector) WatchesGet(id string) (*Watches, error)
- func (c *Connector) WatchesList() ([]*Watches, error)
- func (c *Connector) WatchesUnwatch(user_id string) error
- func (c *Connector) WatchesWatch(user_id, username string) error
- func (c *Connector) WatchesWatching(user_id string) (bool, error)
- type H
- type Watches
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func QueryDefaultInteger ¶
QueryDefaultInt retrieves an integer param from the gin request querystring defaults to def argument if not found
func QueryString ¶
QueryString retrieves a string param from the gin request querystring
func WithTimeout ¶
WithTimeout runs a delegate function with a timeout,
Example: Wait for a channel
if value, ok := WithTimeout(func()interface{}{return <- inbox}, time.Second); ok { // returned } else { // didn't return }
Example: To send to a channel
_, ok := WithTimeout(func()interface{}{outbox <- myValue; return nil}, time.Second) if !ok { // didn't send }
Types ¶
type Application ¶
type Application struct { Config *Config Log *zap.SugaredLogger //golem:template:app/app_partial_definitions // DO NOT EDIT. This section is managed by github.com/dashotv/golem. // Models DB *Connector Bot *Bot }
type Channels ¶
type Channels struct { grimoire.Document `bson:",inline"` // includes default model settings //ID primitive.ObjectID `bson:"_id,omitempty" json:"id"` //CreatedAt time.Time `bson:"created_at" json:"created_at"` //UpdatedAt time.Time `bson:"updated_at" json:"updated_at"` GuildId string `bson:"guild_id" json:"guild_id"` ChannelId string `bson:"channel_id" json:"channel_id"` Name string `bson:"name" json:"name"` }
type Config ¶
type Config struct { Mode string `env:"MODE" envDefault:"dev"` Logger string `env:"LOGGER" envDefault:"dev"` Port int `env:"PORT" envDefault:"9999"` Token string `env:"TOKEN" required:"true"` HelpText string //golem:template:app/config_partial_struct // DO NOT EDIT. This section is managed by github.com/dashotv/golem. // Models (Database) Connections ConnectionSet `env:"CONNECTIONS"` }
func (*Config) ConnectionFor ¶
func (c *Config) ConnectionFor(name string) (*Connection, error)
type Connection ¶
type Connection struct { URI string `yaml:"uri,omitempty"` Database string `yaml:"database,omitempty"` Collection string `yaml:"collection,omitempty"` }
func (*Connection) UnmarshalText ¶
func (c *Connection) UnmarshalText(text []byte) error
type ConnectionSet ¶
type ConnectionSet map[string]*Connection
func (*ConnectionSet) UnmarshalText ¶
func (c *ConnectionSet) UnmarshalText(text []byte) error
type Connector ¶
type Connector struct { Log *zap.SugaredLogger Channels *grimoire.Store[*Channels] Watches *grimoire.Store[*Watches] }
func NewConnector ¶
func NewConnector(app *Application) (*Connector, error)
func (*Connector) ChannelsByChannelID ¶
func (*Connector) ChannelsCreateUpdate ¶
func (*Connector) ChannelsDelete ¶
func (*Connector) ChannelsList ¶
func (*Connector) WatchesByUserID ¶
func (*Connector) WatchesGame ¶
func (*Connector) WatchesList ¶
func (*Connector) WatchesUnwatch ¶
func (*Connector) WatchesWatch ¶
type H ¶
stolen from gin gonic H is a shortcut for map[string]any
func (H) MarshalXML ¶
MarshalXML allows type H to be used with xml.Marshal.
type Watches ¶
type Watches struct { grimoire.Document `bson:",inline"` // includes default model settings //ID primitive.ObjectID `bson:"_id,omitempty" json:"id"` //CreatedAt time.Time `bson:"created_at" json:"created_at"` //UpdatedAt time.Time `bson:"updated_at" json:"updated_at"` Id string `bson:"id" json:"id"` UserId string `bson:"user_id" json:"user_id"` Username string `bson:"username" json:"username"` GuildId string `bson:"guild_id" json:"guild_id"` ChannelId string `bson:"channel_id" json:"channel_id"` Game string `bson:"game" json:"game"` }
Click to show internal directories.
Click to hide internal directories.