database

package
v0.7.5 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2023 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package database represents the data layer of S&D.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DataSourceEntry

type DataSourceEntry struct {
	snd.DataSource
	Count int `json:"count"`
}

DataSourceEntry represents a S&D data source together with the amount of entries it has.

type Database

type Database interface {
	Close() error

	GetSettings() (snd.Settings, error)
	SaveSettings(settings snd.Settings) error

	GetLogs(hours int) ([]log.Entry, error)
	AddLog(e log.Entry) error

	GetTemplate(id string) (snd.Template, error)
	SaveTemplate(template snd.Template) error
	DeleteTemplate(id string) error
	GetTemplates() ([]TemplateEntry, error)

	GetEntries(id string) ([]snd.Entry, error)
	GetEntry(id string, eid string) (snd.Entry, error)
	CountEntries(id string) (int, error)
	SaveEntry(id string, entry snd.Entry) error
	DeleteEntry(id string, eid string) error
	DeleteEntries(id string) error

	GetGenerator(id string) (snd.Generator, error)
	SaveGenerator(generator snd.Generator) error
	DeleteGenerator(id string) error
	GetGenerators() ([]snd.Generator, error)

	SaveSource(ds snd.DataSource) error
	DeleteSource(id string) error
	GetSource(id string) (snd.DataSource, error)
	GetSources() ([]DataSourceEntry, error)
}

Database represents all database functions that are needed for S&D to work.

type TemplateEntry

type TemplateEntry struct {
	snd.Template
	Count int `json:"count"`
}

TemplateEntry represents a S&D template together with the amount of entries it has.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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