data

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: May 3, 2025 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetDatabase

func GetDatabase() *sql.DB

GetDatabase will return the shared instance of the actual database.

func GetEmojiList added in v0.1.0

func GetEmojiList() []generated.Emoji

GetEmojiList returns a list of custom emoji from the emoji directory.

func SetupEmojiDirectory added in v0.1.0

func SetupEmojiDirectory() (err error)

SetupEmojiDirectory sets up the custom emoji directory by copying all built-in emojis if the directory does not yet exist.

func SetupPersistence

func SetupPersistence(file string) error

SetupPersistence will open the datastore and make it available.

func UpdateEmojiList added in v0.1.1

func UpdateEmojiList(force bool) (time.Time, error)

UpdateEmojiList will update the cache (if required) and return the modifiation time.

Types

type Datastore added in v0.0.6

type Datastore struct {
	DB *sql.DB

	DbLock *sync.Mutex
	// contains filtered or unexported fields
}

Datastore is the global key/value store for configuration values.

func GetDatastore added in v0.0.8

func GetDatastore() *Datastore

GetDatastore returns the shared instance of the owncast datastore.

func GetStore added in v0.0.6

func GetStore() *Datastore

GetStore will return the shared instance of the read/write datastore.

func (*Datastore) Get added in v0.0.6

func (ds *Datastore) Get(key string) (models.ConfigEntry, error)

Get will query the database for the key and return the entry.

func (*Datastore) GetBool added in v0.0.6

func (ds *Datastore) GetBool(key string) (bool, error)

GetBool will return the boolean value for a key.

func (*Datastore) GetCachedValue added in v0.0.6

func (ds *Datastore) GetCachedValue(key string) ([]byte, error)

GetCachedValue will return a value for key from the cache.

func (*Datastore) GetNumber added in v0.0.6

func (ds *Datastore) GetNumber(key string) (float64, error)

GetNumber will return the numeric value for a key.

func (*Datastore) GetQueries added in v0.0.11

func (ds *Datastore) GetQueries() *db.Queries

GetQueries will return the shared instance of the SQL query generator.

func (*Datastore) GetString added in v0.0.6

func (ds *Datastore) GetString(key string) (string, error)

GetString will return the string value for a key.

func (*Datastore) GetStringMap added in v0.1.0

func (ds *Datastore) GetStringMap(key string) (map[string]string, error)

GetStringMap will return the string map value for a key.

func (*Datastore) GetStringSlice added in v0.0.12

func (ds *Datastore) GetStringSlice(key string) ([]string, error)

GetStringSlice will return the string slice value for a key.

func (*Datastore) MustExec added in v0.0.13

func (ds *Datastore) MustExec(s string)

MustExec will execute a SQL statement on a provided database instance.

func (*Datastore) Reset added in v0.0.6

func (ds *Datastore) Reset()

Reset will delete all config entries in the datastore and start over.

func (*Datastore) Save added in v0.0.6

func (ds *Datastore) Save(e models.ConfigEntry) error

Save will save the ConfigEntry to the database.

func (*Datastore) SetBool added in v0.0.6

func (ds *Datastore) SetBool(key string, value bool) error

SetBool will set the boolean value for a key.

func (*Datastore) SetCachedValue added in v0.0.6

func (ds *Datastore) SetCachedValue(key string, b []byte)

SetCachedValue will set a value for key in the cache.

func (*Datastore) SetNumber added in v0.0.6

func (ds *Datastore) SetNumber(key string, value float64) error

SetNumber will set the numeric value for a key.

func (*Datastore) SetString added in v0.0.6

func (ds *Datastore) SetString(key string, value string) error

SetString will set the string value for a key.

func (*Datastore) SetStringMap added in v0.1.0

func (ds *Datastore) SetStringMap(key string, value map[string]string) error

SetStringMap will set the string map value for a key.

func (*Datastore) SetStringSlice added in v0.0.12

func (ds *Datastore) SetStringSlice(key string, value []string) error

SetStringSlice will set the string slice value for a key.

func (*Datastore) Setup added in v0.0.6

func (ds *Datastore) Setup()

Setup will perform initial initialization.

func (*Datastore) WarmCache added in v0.2.0

func (ds *Datastore) WarmCache()

WarmCache pre-caches all configuration values in memory.

Jump to

Keyboard shortcuts

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