database

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: May 18, 2021 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddBot

func AddBot(username, password string) (int, error)

AddBot adds a new bot into the database

func AddOther

func AddOther(username, status string) (int, error)

AddOther adds a new other account (ally, neutral or enemy) into the database

func ConfigDirectory

func ConfigDirectory() string

ConfigDirectory

func CreateDB

func CreateDB(loc string) error

CreateDB creates a new database and sets all the needed tables.

func DBPath

func DBPath() (string, error)

DBPath returns a location where the DB is located.

func DeleteBot

func DeleteBot(botName string) error

DeleteBot deletes a bot from the database.

func DeleteOther

func DeleteOther(otherName, status string) error

DeleteOther deletes account of others from the database.

func DisableBot

func DisableBot(botName string) error

DisableBot deletes a bot from the database.

func EnableBot

func EnableBot(botName string) error

EnableBot deletes a bot from the database.

func EnsureExists

func EnsureExists()

EnsureExists ensures that DB exists. If not, it setups a new database.

func ListBots

func ListBots() error

ListBots lists all bots

func ListOthers

func ListOthers(status string) error

ListOthers lists all others which have specified status (ally, neutral, enemy)

Types

type Bot

type Bot struct {
	ID       int
	Username string
	Password string
}

Bot holds all the data for the single bot

func GetBots

func GetBots(username string, onlyActive bool) ([]Bot, error)

GetBots gets login information of all active bots from the database.

type Other

type Other struct {
	ID       int
	Username string
	Status   string
}

Other holds all the data for the single other account (ally, neutral, enemy)

func GetOthers

func GetOthers(username, status string) ([]Other, error)

GetOthers gets usernames of all active accounts of others (ally, neutral or enemy) from the database.

Jump to

Keyboard shortcuts

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