db

package
v0.0.0-...-d17e1d7 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Database interaction package.

Index

Constants

View Source
const SCHEMA = `` /* 389-byte string literal not displayed */

SQL Queries to create the schemas.

Variables

View Source
var DB *sqlx.DB

Functions

func Begin

func Begin() (*sqlx.Tx, error)

func Close

func Close() error

func Exec

func Exec(query string, args ...interface{}) (sql.Result, error)

func Get

func Get(dest interface{}, query string, args ...interface{}) error

func GetBalance

func GetBalance(id, guild string) int64

func GetPrefix

func GetPrefix(id string) string

func MustBegin

func MustBegin() *sqlx.Tx

func MustExec

func MustExec(query string, args ...interface{}) sql.Result

func Query

func Query(query string, args ...interface{}) (*sql.Rows, error)

func QueryRow

func QueryRow(query string, args ...interface{}) *sql.Row

func SetPrefix

func SetPrefix(guild, prefix string) error

Types

type Bot

type Bot struct {
	ID  string `db:"id"`
	PSA struct {
		Text string `db:"text"`
		Date int64  `db:"date"`
	} `db:"psa"`
}

func GetBotData

func GetBotData() (*Bot, error)

type Guild

type Guild struct {
	ID     string `db:"id"`
	Prefix string `db:"prefix"`
}

func GetGuild

func GetGuild(id string) (*Guild, error)

type Member

type Member struct {
	ID     string `db:"id"`
	Guild  string `db:"guild"`
	Points int64  `db:"points"`
	Level  int    `db:"level"`
}

Jump to

Keyboard shortcuts

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