Documentation
¶
Index ¶
- Constants
- type ChannelConfig
- type Collection
- type DataLayer
- type MongoCollection
- type MongoDatabase
- func (d MongoDatabase) C(name string) Collection
- func (db *MongoDatabase) GetCallback(callbackID string) (*SlashCommand, error)
- func (db *MongoDatabase) GetChannelConfig(channelID string) (*ChannelConfig, error)
- func (db *MongoDatabase) RemoveCallback(callbackID string) error
- func (db *MongoDatabase) RemoveStaleCallbacks(timeout int64) error
- func (db *MongoDatabase) SetChannelConfig(channelConfig *ChannelConfig) error
- func (db *MongoDatabase) SetChannelProject(channelID string, project string) error
- func (db *MongoDatabase) StoreCallback(callbackID string, command *SlashCommand) error
- type MongoSession
- type Session
- type SlashCommand
Constants ¶
View Source
const CALLBACK_COLLECTION = "internal_callbacks"
View Source
const CONFIG_COLLECTION = "channel_configs"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ChannelConfig ¶
type Collection ¶
type Collection interface {
Find(query interface{}) *mgo.Query
Count() (n int, err error)
FindId(id interface{}) *mgo.Query
Insert(docs ...interface{}) error
Remove(selector interface{}) error
Update(selector interface{}, update interface{}) error
Upsert(selector interface{}, update interface{}) (info *mgo.ChangeInfo, err error)
UpsertId(id interface{}, update interface{}) (info *mgo.ChangeInfo, err error)
EnsureIndex(index mgo.Index) error
RemoveAll(selector interface{}) (info *mgo.ChangeInfo, err error)
}
type DataLayer ¶
type DataLayer interface {
C(name string) Collection
SetChannelProject(channelID string, project string) error
SetChannelConfig(config *ChannelConfig) error
GetChannelConfig(channelID string) (*ChannelConfig, error)
StoreCallback(callbackID string, command *SlashCommand) error
RemoveCallback(callbackID string) error
RemoveStaleCallbacks(timeout int64) error
GetCallback(callbackID string) (*SlashCommand, error)
}
type MongoCollection ¶
type MongoCollection struct {
*mgo.Collection
}
type MongoDatabase ¶
func (MongoDatabase) C ¶
func (d MongoDatabase) C(name string) Collection
func (*MongoDatabase) GetCallback ¶
func (db *MongoDatabase) GetCallback(callbackID string) (*SlashCommand, error)
func (*MongoDatabase) GetChannelConfig ¶
func (db *MongoDatabase) GetChannelConfig(channelID string) (*ChannelConfig, error)
func (*MongoDatabase) RemoveCallback ¶
func (db *MongoDatabase) RemoveCallback(callbackID string) error
func (*MongoDatabase) RemoveStaleCallbacks ¶
func (db *MongoDatabase) RemoveStaleCallbacks(timeout int64) error
func (*MongoDatabase) SetChannelConfig ¶
func (db *MongoDatabase) SetChannelConfig(channelConfig *ChannelConfig) error
func (*MongoDatabase) SetChannelProject ¶
func (db *MongoDatabase) SetChannelProject(channelID string, project string) error
func (*MongoDatabase) StoreCallback ¶
func (db *MongoDatabase) StoreCallback(callbackID string, command *SlashCommand) error
type MongoSession ¶
MongoSession is currently a Mongo session.
func (MongoSession) DB ¶
func (s MongoSession) DB(name string) DataLayer
DB shadows *mgo.DB to returns a DataLayer interface instead of *mgo.Database.
type Session ¶
type Session interface {
DB(name string) DataLayer
SetSafe(safe *mgo.Safe)
SetSyncTimeout(d time.Duration)
SetSocketTimeout(d time.Duration)
Close()
Copy() Session
}
Session is an interface to access to the Session struct.
type SlashCommand ¶
type SlashCommand struct {
Token string `schema:"token"`
TeamID string `schema:"team_id" bson:"team_id"`
TeamDomain string `schema:"team_domain" bson:"team_domain"`
EnterpriseID string `schema:"enterprise_id" bson:"enterprise_id"`
EnterpriseName string `schema:"enterprise_name" bson:"enterprise_name"`
ChannelID string `schema:"channel_id" bson:"channel_id"`
ChannelName string `schema:"channel_name" bson:"channel_name"`
UserID string `schema:"user_id" bson:"user_id"`
UserName string `schema:"user_name" bson:"user_name"`
Command string `schema:"command"`
Text string `schema:"text"`
ResponseURL string `schema:"response_url" bson:"response_url"`
TriggerID string `schema:"trigger_id" bson:"trigger_id"`
Timestamp int64 `schema:"timestamp"`
Config *ChannelConfig `bson:"-"`
}
Click to show internal directories.
Click to hide internal directories.