rsdb

package
v0.0.0-...-81c28c1 Latest Latest
Warning

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

Go to latest
Published: May 2, 2020 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Addimgwtags

func Addimgwtags(db *bolt.DB, fn string, iw int, ih int, isz int, contr string,
	tags []string, w http.ResponseWriter, settings rscore.Settings) rscore.Settings

Stores image object in database TODO make work for batchimport

func Addtextwtags

func Addtextwtags(text string, tags []string, db *bolt.DB,
	uname string, mxindex int, buc []byte)

Conditionally adds tagged text to database

func Addutoindex

func Addutoindex(db *bolt.DB, uname string,
	settings rscore.Settings) rscore.Settings

Append uname to database index

func Countobj

func Countobj(db *bolt.DB, tn string, buc []byte) int

Returns number of text objects per tag from db

func Getkeyfromsel

func Getkeyfromsel(db *bolt.DB, tags []string, buc []byte, kmax int) []byte

Returns a random key based on tag list

func Getrndimg

func Getrndimg(db *bolt.DB, kmax int, tags []string, buc []byte) rscore.Imgobj

Sends random image url from database, based on requested tags

func Getrndtxt

func Getrndtxt(db *bolt.DB, kmax int, tags []string, buc []byte) string

Sends random text object from database, based on requested tags

func Imgobjctr

func Imgobjctr(db *bolt.DB, t string) int

Image wrapper for rsdb.Countobj()

func Isindb

func Isindb(db *bolt.DB, k []byte, buc []byte) bool

Returns true if key returns something from database

func Mksel

func Mksel(db *bolt.DB, tags []string, buc []byte) []int

Creates valid selection list from tags

func Mv

func Mv(db *bolt.DB, sk []byte, dk []byte, cbuc []byte) error

Moves db value from sk to dk

func Open

func Open(dbname string) *bolt.DB

Opens the database

func Rdb

func Rdb(db *bolt.DB, k []byte, cbuc []byte) (v []byte, e error)

Return JSON encoded byte slice from DB

func Rdeck

func Rdeck(db *bolt.DB, deck rscore.Deck, id int,
	settings rscore.Settings) rscore.Deck

Returns deck from database

func Rmfilists

func Rmfilists(db *bolt.DB, tags []rscore.Rtag, i int, buc []byte)

Removes object from all relevant index lists

func Rmkv

func Rmkv(db *bolt.DB, k []byte, cbuc []byte) (e error)

Unconditionaly removes k/v pair from database

func Rmufrindex

func Rmufrindex(db *bolt.DB, uname string,
	settings rscore.Settings) rscore.Settings

Removes user name from index

func Rsettings

func Rsettings(db *bolt.DB) rscore.Settings

Wrapper for reading settings from database

func Rtindex

func Rtindex(db *bolt.DB) rscore.Tagresp

Reads tag index from db

func Ruindex

func Ruindex(db *bolt.DB, settings rscore.Settings) rscore.Uindex

Returns user index

func Ruser

func Ruser(db *bolt.DB, uname string) rscore.User

Returns user account from database

func Tagstoindex

func Tagstoindex(tags []string, settings rscore.Settings) (int, rscore.Settings)

Updates index to include new tags

func Uilists

func Uilists(db *bolt.DB, tags []string, i int, buc []byte)

Updates all relevant index lists

func Updatertag

func Updatertag(db *bolt.DB, t string) rscore.Rtag

Returns updated rtag object

func Updatetindex

func Updatetindex(db *bolt.DB)

Updates tag index

func Wrdb

func Wrdb(db *bolt.DB, k []byte, v []byte, cbuc []byte) (e error)

Write JSON encoded byte slice to DB

func Wrdeck

func Wrdeck(db *bolt.DB, deck rscore.Deck)

Writes deck to database

func Wrimage

func Wrimage(db *bolt.DB, k []byte, img rscore.Imgobj)

Writes image to database

func Wrsettings

func Wrsettings(db *bolt.DB, settings rscore.Settings)

Wrapper for writing settings to database

func Wrtindex

func Wrtindex(db *bolt.DB, tindex rscore.Tagresp)

Writes tag index to db

func Wruindex

func Wruindex(db *bolt.DB, users rscore.Uindex,
	settings rscore.Settings) rscore.Settings

Write user index to database

func Wruser

func Wruser(db *bolt.DB, u rscore.User)

Writes user to database

Types

This section is empty.

Jump to

Keyboard shortcuts

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