db

package
v0.0.0-...-a82784a Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2024 License: MPL-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotFound error = errors.New("record not found")
	ErrInsert   error = errors.New("record insertion failure")
	ErrDelete   error = errors.New("error deleting record")
)

Functions

func Close

func Close() error

func DeleleOneCallout

func DeleleOneCallout(ctx context.Context, c *Callout) error
func DeleteLink(ctx context.Context, l *Link) error

func DeleteMedia

func DeleteMedia(ctx context.Context, m *Media) error

func Drop

func Drop() error

func ExportDB

func ExportDB() (ret map[string]*bytes.Buffer, err error)

func ExportDBToFiles

func ExportDBToFiles(filepath string) ([]string, error)

func ExportTable

func ExportTable(table string) (*bytes.Buffer, error)

func ExportTableToFile

func ExportTableToFile(filename, table string) error

func InsertAbraxas

func InsertAbraxas(ctx context.Context, a *Abraxas) error

func InsertCallout

func InsertCallout(ctx context.Context, c *Callout) error

func InsertChannelStats

func InsertChannelStats(ctx context.Context, channel, user string, points int64) error

func InsertGroup

func InsertGroup(ctx context.Context, gid, title string) error
func InsertLink(ctx context.Context, l *Link) error

func InsertMedia

func InsertMedia(ctx context.Context, m *Media) error

func InsertStatistics

func InsertStatistics(ctx context.Context, val, kind int64) error

func InsertStatisticsKind

func InsertStatisticsKind(ctx context.Context, k *StatisticsKind) (int64, error)

func Migrate

func Migrate() error

func MigrateDown

func MigrateDown() error

func MigrateTo

func MigrateTo(version uint) error

func Open

func Open(filename string) error

func SelectAbraxoidesAbraxas

func SelectAbraxoidesAbraxas(ctx context.Context, gid string) ([]string, error)

func SelectAbraxoidesAbraxasKind

func SelectAbraxoidesAbraxasKind(ctx context.Context, gid string) ([][]string, error)

func SelectAllCallouts

func SelectAllCallouts(ctx context.Context, gid string) ([]string, error)

func SelectLinkByURL

func SelectLinkByURL(ctx context.Context, l *Link) error

func SelectOneAbraxasByAbraxas

func SelectOneAbraxasByAbraxas(ctx context.Context, a *Abraxas) error

func SelectOneCallout

func SelectOneCallout(ctx context.Context, c *Callout) error

func SelectOneGroup

func SelectOneGroup(ctx context.Context, g *Group) error

func SelectOneMediaByData

func SelectOneMediaByData(ctx context.Context, m *Media) error

func SelectRandomMedia

func SelectRandomMedia(ctx context.Context, m *Media) error

Types

type Abraxas

type Abraxas struct {
	Abraxas string `db:"abraxas"`
	Kind    string `db:"kind"`
	GID     string `db:"gid"`
}

func SelectAbraxoides

func SelectAbraxoides(ctx context.Context, gid string) ([]*Abraxas, error)

func (*Abraxas) Clone

func (a *Abraxas) Clone() *Abraxas

type Callout

type Callout struct {
	Callout string `db:"callout"`
	Text    string `db:"text"`
	GID     string `db:"gid"`
}

func (*Callout) Clone

func (c *Callout) Clone() *Callout

type ChannelStats

type ChannelStats struct {
	GID    string
	TS     time.Time
	User   string
	Points int64
}

func SelectChannelStatsTimeSeries

func SelectChannelStatsTimeSeries(ctx context.Context, channel string) ([]*ChannelStats, error)

type Group

type Group struct {
	GID   string `db:"gid"`
	Title string `db:"title"`
}

func SelectAllGroups

func SelectAllGroups(ctx context.Context) ([]*Group, error)

func (*Group) Clone

func (g *Group) Clone() *Group
type Link struct {
	URL  string `db:"url"`
	Text string `db:"text"`
	GID  string `db:"gid"`
}
func SearchLinks(ctx context.Context, gid, term string) (links []*Link, err error)

func (*Link) Clone

func (l *Link) Clone() *Link

type Media

type Media struct {
	GID         string `db:"gid"`
	Data        string `db:"data"`
	Kind        string `db:"kind"`
	Description string `db:"description"`
}

func SearchMedia

func SearchMedia(ctx context.Context, gid, term string) (*Media, error)

func SelectAllMedia

func SelectAllMedia(ctx context.Context) ([]*Media, error)

func SelectAllMediaGroup

func SelectAllMediaGroup(ctx context.Context, gid string) ([]*Media, error)

func (*Media) Clone

func (m *Media) Clone() *Media

type Statistics

type Statistics struct {
	KindID int64
	Value  int64
	Date   time.Time
}

type StatisticsJoin

type StatisticsJoin struct {
	Name  string
	Value int64
	Date  time.Time
}

func SelectStatisticsByDateRange

func SelectStatisticsByDateRange(ctx context.Context, timeFrom, timeTo time.Time) ([]*StatisticsJoin, error)

func SelectStatisticsLatest

func SelectStatisticsLatest(ctx context.Context) ([]*StatisticsJoin, error)

type StatisticsKind

type StatisticsKind struct {
	KindID   int64
	Name     string
	Trigger  string
	IsRegexp bool
}

func SelectStatisticKinds

func SelectStatisticKinds(ctx context.Context) ([]*StatisticsKind, error)

Jump to

Keyboard shortcuts

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