db

package
v0.0.0-...-ba096a2 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2018 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

All database interactions and database tables within moebot's database

Index

Constants

View Source
const (
	RoleGroupMaxNameLength       = 500
	RoleGroupMaxNameLengthString = "500"

	UncategorizedGroup = "Uncategorized"
)
View Source
const (
	DbMaxUidLength         = 20
	MaxMessageLength       = 1900
	MaxMessageLengthString = "1900"
)
View Source
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

View Source
const (
	RoleMaxTriggerLength       = 100
	RoleMaxTriggerLengthString = "100"
)
View Source
const (
	/*
		Metric representing a timer. This should store JSON data regarding timers and time data
	*/
	MetricTypeTimer types.MetricType = 1
)
View Source
const (
	RaffleDataSeparator = "|"
)
View Source
const (
	SchedulerChannelRotation types.SchedulerType = 1
)

Variables

This section is empty.

Functions

func ChannelQueryById

func ChannelQueryById(channelId int) (c *types.Channel, e error)

func ChannelQueryByServer

func ChannelQueryByServer(server types.Server) (channels []types.Channel, err error)

func ChannelQueryOrInsert

func ChannelQueryOrInsert(channelUid string, server *types.Server) (c *types.Channel, e error)

func ChannelRotationAdd

func ChannelRotationAdd(serverID int, currentChannelUID string, channels []string, interval string) error

func ChannelRotationQuery

func ChannelRotationQuery(operationID int64) (*types.ChannelRotation, error)

func ChannelRotationUpdate

func ChannelRotationUpdate(operationID int64, currentChannelUID string) error

func ChannelUpdate

func ChannelUpdate(channel *types.Channel) (err error)

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 GetGroupTypeFromString(s string) types.GroupType

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 GetStringFromGroupType(groupType types.GroupType) string

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 OpenTransaction() (tx *sql.Tx)

func PollAdd

func PollAdd(poll *types.Poll) error

func PollClose

func PollClose(id int) error

func PollOptionAdd

func PollOptionAdd(poll *types.Poll) error

func PollOptionQuery

func PollOptionQuery(pollId int) ([]*types.PollOption, error)

func PollOptionUpdateVotes

func PollOptionUpdateVotes(poll *types.Poll) error

func PollQuery

func PollQuery(id int) (*types.Poll, error)

func PollSetMessageId

func PollSetMessageId(poll *types.Poll) error

func PollsOpenQuery

func PollsOpenQuery() ([]*types.Poll, error)

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 RoleDelete(roleUid string, guildUid string) error

func RoleGroupDelete

func RoleGroupDelete(id int) error

func RoleGroupInsertOrUpdate

func RoleGroupInsertOrUpdate(rg types.RoleGroup, s types.Server) (newId int, err error)

func RoleGroupQueryId

func RoleGroupQueryId(id int) (rg types.RoleGroup, err error)

func RoleGroupQueryName

func RoleGroupQueryName(name string, serverId int) (rg types.RoleGroup, err error)

func RoleGroupQueryOrInsert

func RoleGroupQueryOrInsert(rg types.RoleGroup, s types.Server) (newRg types.RoleGroup, err error)

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 RoleGroupQueryServer(s types.Server) (roleGroups []types.RoleGroup, err error)

func RoleInsertOrUpdate

func RoleInsertOrUpdate(role types.Role) error

func RoleQueryGroup

func RoleQueryGroup(groupId int) (roles []types.Role, err error)

func RoleQueryOrInsert

func RoleQueryOrInsert(role types.Role) (r types.Role, err error)

func RoleQueryPermission

func RoleQueryPermission(roleUids []string) (p []types.Permission)

func RoleQueryRoleUid

func RoleQueryRoleUid(roleUid string, serverId int) (r types.Role, err error)

func RoleQueryServer

func RoleQueryServer(s types.Server) (roles []types.Role, err error)

func RoleQueryTrigger

func RoleQueryTrigger(trigger string, serverId int) (r types.Role, err error)

func ScheduledOperationDelete

func ScheduledOperationDelete(operationID int64, serverID int) (bool, error)

func ScheduledOperationQueryNow

func ScheduledOperationQueryNow() ([]*types.ScheduledOperation, error)

func ScheduledOperationQueryServer

func ScheduledOperationQueryServer(serverID int) ([]*types.ScheduledOperation, error)

func ScheduledOperationUpdateTime

func ScheduledOperationUpdateTime(operationID int64) (time.Time, error)

func ServerFullUpdate

func ServerFullUpdate(s types.Server) (err error)

func ServerQueryById

func ServerQueryById(id int) (s types.Server, e error)

func ServerQueryOrInsert

func ServerQueryOrInsert(guildUid string) (s types.Server, e error)

func ServerSprint

func ServerSprint(s types.Server) (out string)

func SetupDatabase

func SetupDatabase(host string, dbPass string, moeDataPass string)

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)

func UserServerRankSetMessageSent

func UserServerRankSetMessageSent(entries []int) (err error)

func UserServerRankUpdateOrInsert

func UserServerRankUpdateOrInsert(userId int, serverId int, points int) (id int, newPoint int, messageSent bool, err error)

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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