db

package
v0.0.0-...-ad7117f Latest Latest
Warning

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

Go to latest
Published: May 1, 2020 License: Apache-2.0 Imports: 9 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddRespec

func AddRespec(respec *types.Respec)

AddRespec Updates the respec in the database

func DeleteDB

func DeleteDB(dbFileName string) error

DeleteDB Delete the database file specified by the given name

func GetChannel

func GetChannel(channelID, APIID string) *types.Channel

GetChannel Get the channel identified by the channel ID in the given API

func GetChannelLastMessage

func GetChannelLastMessage(channel *types.Channel) *types.Message

GetChannelLastMessage Get the last message posted in the given channel

func GetGlobalRespec

func GetGlobalRespec() []*types.Respec

GetGlobalRespec Gets the respec of every user in every server

func GetGlobalStats

func GetGlobalStats() types.PairList

GetGlobalStats Gets a list of users and their scores in all servers and channels

func GetGlobalUsers

func GetGlobalUsers() []*types.User

GetGlobalUsers Gets a list of all users from the database

func GetLastMessage

func GetLastMessage(user *types.User, channel *types.Channel) *types.Message

GetLastMessage Get the last message by the given user posted in the given channel

func GetLastRespecTime

func GetLastRespecTime(user *types.User, channel *types.Channel) *time.Time

GetLastRespecTime Get's the time.Time of the last time a given users respec was updated in the given channel

func GetLocalRespec

func GetLocalRespec(channel *types.Channel) []*types.Respec

GetLocalRespec Gets the respec of every user in the given channel

func GetLocalStats

func GetLocalStats(channel *types.Channel) types.PairList

GetLocalStats Gets a list of users and their scores in the given channel

func GetServer

func GetServer(serverID, APIID string) *types.Server

GetServer Get the server identified by the serverID in the given API

func GetServerLosers

func GetServerLosers(server *types.Server) []*types.User

GetServerLosers Get a list of users with a negative score in the given server

func GetServerRespec

func GetServerRespec(server *types.Server) []*types.Respec

GetServerRespec Gets the respec of every user in the given server

func GetServerRespecCap

func GetServerRespecCap(server *types.Server) int

GetServerRespecCap Gets the soft respec cap in the given server (max of (7/16 of total respec) or (100))

func GetServerRulingClass

func GetServerRulingClass(server *types.Server) []*types.User

GetServerRulingClass Gets a list of users who hold the top 50% of respec in the given server

func GetServerStats

func GetServerStats(server *types.Server) types.PairList

GetServerStats Gets a list of users and their scores in the given server

func GetServerTopUser

func GetServerTopUser(server *types.Server) *types.User

GetServerTopUser Gets the top user in the given server

func GetServerUsers

func GetServerUsers(server *types.Server) []*types.User

GetServerUsers Gets a list of all users in the given server from the database

func GetTotalRespec

func GetTotalRespec() int

GetTotalRespec Gets the total positive respec in every server combined

func GetTotalServerRespec

func GetTotalServerRespec(server *types.Server) int

GetTotalServerRespec Gets the total positive respec in the given server

func GetUser

func GetUser(UserID, APIID string) *types.User

GetUser Get the user identified by their user ID in the given API

func GetUserLastMessages

func GetUserLastMessages(user *types.User, channel *types.Channel, amount int) []*types.Message

GetUserLastMessages Get the last 'amount' messages by the given user posted in the given channel

func GetUserLocalRespec

func GetUserLocalRespec(user *types.User, channel *types.Channel) int

GetUserLocalRespec Gets the total respec of a given user in the given channel

func GetUserServerRespec

func GetUserServerRespec(user *types.User, server *types.Server) int

GetUserServerRespec Gets the total respec of a given user in the given server

func IsMessageUnique

func IsMessageUnique(message *types.Message) bool

IsMessageUnique Check if the author of the given message has posted the same thing in their last 25 posts

func IsMultiPosting

func IsMultiPosting(message *types.Message) bool

IsMultiPosting Check if the last 3 posts in the channel are by the author of the given message

func NewChannel

func NewChannel(channel *types.Channel)

NewChannel Insert the channel into the database. Fills the 'Key' field

func NewMessage

func NewMessage(message *types.Message)

NewMessage Insert the given message into the database. Fills the 'Key' field

func NewServer

func NewServer(server *types.Server)

NewServer Insert the server into the database. Fills the 'Key' field

func NewUser

func NewUser(user *types.User) error

NewUser Insert the user into the database. Fills the 'Key' field'

func Purge

func Purge() error

Purge Delete all files related to this app in the userdata directory

func Setup

func Setup(dbFileName string) error

Setup Create a directory in userdata to store the database file and any other files generated by this program

func UpdateChannel

func UpdateChannel(channel *types.Channel)

UpdateChannel Updates and channel information to the stored channel in database

Types

This section is empty.

Jump to

Keyboard shortcuts

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