Documentation ¶
Overview ¶
All database interactions and database tables within moebot's database
Index ¶
- Constants
- func ChannelQueryById(channelId int) (c *types.Channel, e error)
- func ChannelQueryByServer(server types.Server) (channels []types.Channel, err error)
- func ChannelQueryOrInsert(channelUid string, server *types.Server) (c *types.Channel, e error)
- func ChannelRotationAdd(serverID int, currentChannelUID string, channels []string, interval string) error
- func ChannelRotationQuery(operationID int64) (*types.ChannelRotation, error)
- func ChannelRotationUpdate(operationID int64, currentChannelUID string) error
- func ChannelUpdate(channel *types.Channel) (err error)
- func DisconnectAll()
- func FlushServerCache()
- func GetAssignableRoles() string
- func GetGroupTypeFromString(s string) types.GroupType
- func GetPermissionFromString(s string) types.Permission
- func GetPermissionString(p types.Permission) string
- func GetStringFromGroupType(groupType types.GroupType) string
- func IsAssignablePermissionLevel(p types.Permission) bool
- func MetricInsertTimer(metric event.Timer, user types.UserProfile) error
- func OpenTransaction() (tx *sql.Tx)
- func PollAdd(poll *types.Poll) error
- func PollClose(id int) error
- func PollOptionAdd(poll *types.Poll) error
- func PollOptionQuery(pollId int) ([]*types.PollOption, error)
- func PollOptionUpdateVotes(poll *types.Poll) error
- func PollQuery(id int) (*types.Poll, error)
- func PollSetMessageId(poll *types.Poll) error
- func PollsOpenQuery() ([]*types.Poll, error)
- func RaffleEntryAdd(entry types.RaffleEntry) error
- func RaffleEntryQuery(userUid string, guildUid string) (raffleEntries []types.RaffleEntry, err error)
- func RaffleEntryQueryAny(guildUid string) (raffleEntries []types.RaffleEntry, err error)
- func RaffleEntryUpdate(entry types.RaffleEntry, ticketAdd int) error
- func RaffleEntryUpdateMany(entries []types.RaffleEntry, ticketAdd int) error
- func RoleDelete(roleUid string, guildUid string) error
- func RoleGroupDelete(id int) error
- func RoleGroupInsertOrUpdate(rg types.RoleGroup, s types.Server) (newId int, err error)
- func RoleGroupQueryId(id int) (rg types.RoleGroup, err error)
- func RoleGroupQueryName(name string, serverId int) (rg types.RoleGroup, err error)
- func RoleGroupQueryOrInsert(rg types.RoleGroup, s types.Server) (newRg types.RoleGroup, err error)
- func RoleGroupQueryServer(s types.Server) (roleGroups []types.RoleGroup, err error)
- func RoleInsertOrUpdate(role types.Role) error
- func RoleQueryGroup(groupId int) (roles []types.Role, err error)
- func RoleQueryOrInsert(role types.Role) (r types.Role, err error)
- func RoleQueryPermission(roleUids []string) (p []types.Permission)
- func RoleQueryRoleUid(roleUid string, serverId int) (r types.Role, err error)
- func RoleQueryServer(s types.Server) (roles []types.Role, err error)
- func RoleQueryTrigger(trigger string, serverId int) (r types.Role, err error)
- func ScheduledOperationDelete(operationID int64, serverID int) (bool, error)
- func ScheduledOperationQueryNow() ([]*types.ScheduledOperation, error)
- func ScheduledOperationQueryServer(serverID int) ([]*types.ScheduledOperation, error)
- func ScheduledOperationUpdateTime(operationID int64) (time.Time, error)
- func ServerFullUpdate(s types.Server) (err error)
- func ServerQueryById(id int) (s types.Server, e error)
- func ServerQueryOrInsert(guildUid string) (s types.Server, e error)
- func ServerSprint(s types.Server) (out string)
- func SetupDatabase(host string, dbPass string, moeDataPass string)
- func SprintPermission(p types.Permission) string
- func UserQueryOrInsert(userUid string) (u types.UserProfile, err error)
- func UserServerRankQuery(userUid string, guildUid string) (usr *types.UserServerRank, err error)
- func UserServerRankSetMessageSent(entries []int) (err error)
- func UserServerRankUpdateOrInsert(userId int, serverId int, points int) (id int, newPoint int, messageSent bool, err error)
Constants ¶
const ( RoleGroupMaxNameLength = 500 RoleGroupMaxNameLengthString = "500" UncategorizedGroup = "Uncategorized" )
const ( DbMaxUidLength = 20 MaxMessageLength = 1900 MaxMessageLengthString = "1900" )
const ( JustRaffle types.RaffleType // Raffles for the made in abyss server RaffleMIA )
unfortunately these have to be pretty specific until I can come up with a better way to store them. or a more generic raffle system
const ( RoleMaxTriggerLength = 100 RoleMaxTriggerLengthString = "100" )
const ( /* Metric representing a timer. This should store JSON data regarding timers and time data */ MetricTypeTimer types.MetricType = 1 )
const (
RaffleDataSeparator = "|"
)
const (
SchedulerChannelRotation types.SchedulerType = 1
)
Variables ¶
This section is empty.
Functions ¶
func ChannelQueryByServer ¶
func ChannelQueryOrInsert ¶
func ChannelRotationAdd ¶
func ChannelRotationQuery ¶
func ChannelRotationQuery(operationID int64) (*types.ChannelRotation, error)
func ChannelRotationUpdate ¶
func ChannelUpdate ¶
func DisconnectAll ¶
func DisconnectAll()
func FlushServerCache ¶
func FlushServerCache()
func GetAssignableRoles ¶
func GetAssignableRoles() string
Gets a string representing all the possible assignable permission levels
func GetGroupTypeFromString ¶
func GetPermissionFromString ¶
func GetPermissionFromString(s string) types.Permission
Gets a permission value from a string. This should be used when accepting user input.
func GetPermissionString ¶
func GetPermissionString(p types.Permission) string
Gets a string from a permission, which is the user-facing string NOT the assignable string. For example: "Your permission level is: GetPermissionString(PermAll)"
func GetStringFromGroupType ¶
func IsAssignablePermissionLevel ¶
func IsAssignablePermissionLevel(p types.Permission) bool
Currently only a subset of roles are assignable by the bot
func MetricInsertTimer ¶
func MetricInsertTimer(metric event.Timer, user types.UserProfile) error
func OpenTransaction ¶
func PollOptionAdd ¶
func PollOptionQuery ¶
func PollOptionQuery(pollId int) ([]*types.PollOption, error)
func PollOptionUpdateVotes ¶
func PollSetMessageId ¶
func PollsOpenQuery ¶
func RaffleEntryAdd ¶
func RaffleEntryAdd(entry types.RaffleEntry) error
func RaffleEntryQuery ¶
func RaffleEntryQuery(userUid string, guildUid string) (raffleEntries []types.RaffleEntry, err error)
func RaffleEntryQueryAny ¶
func RaffleEntryQueryAny(guildUid string) (raffleEntries []types.RaffleEntry, err error)
func RaffleEntryUpdate ¶
func RaffleEntryUpdate(entry types.RaffleEntry, ticketAdd int) error
func RaffleEntryUpdateMany ¶
func RaffleEntryUpdateMany(entries []types.RaffleEntry, ticketAdd int) error
func RoleDelete ¶
func RoleGroupDelete ¶
func RoleGroupInsertOrUpdate ¶
func RoleGroupQueryName ¶
func RoleGroupQueryOrInsert ¶
Returns a RoleGroup matching the id inside the given RoleGroup. If no match is found, the RoleGroup is added to the database
func RoleGroupQueryServer ¶
func RoleInsertOrUpdate ¶
func RoleQueryPermission ¶
func RoleQueryPermission(roleUids []string) (p []types.Permission)
func RoleQueryRoleUid ¶
func RoleQueryTrigger ¶
func ScheduledOperationQueryNow ¶
func ScheduledOperationQueryNow() ([]*types.ScheduledOperation, error)
func ScheduledOperationQueryServer ¶
func ScheduledOperationQueryServer(serverID int) ([]*types.ScheduledOperation, error)
func ServerFullUpdate ¶
func ServerSprint ¶
func SetupDatabase ¶
Does all processing related to setting up the database for moebot
func SprintPermission ¶
func SprintPermission(p types.Permission) string
Gets a string from a permission level for use when informing users of what permission they can enter
func UserQueryOrInsert ¶
func UserQueryOrInsert(userUid string) (u types.UserProfile, err error)
func UserServerRankQuery ¶
func UserServerRankQuery(userUid string, guildUid string) (usr *types.UserServerRank, err error)
Types ¶
This section is empty.