Documentation
¶
Overview ¶
Package to manipulate database, with go types instead of direct SQL queries, ensure simplicity and safety.
Index ¶
- Variables
- func AddTag(db *lazydb.LazyDB, tags ...string) error
- func GetAllTags(db *lazydb.LazyDB) ([]string, error)
- func GetGenreList(db *lazydb.LazyDB) ([]string, error)
- func GetPublisherList(db *lazydb.LazyDB) ([]string, error)
- func InsertGenre(db *lazydb.LazyDB, value ...string) error
- func InsertMultiHistory(db *lazydb.LazyDB, values ...HistoryVal) error
- func InsertPublisher(db *lazydb.LazyDB, value ...string) error
- type HistoryVal
Constants ¶
This section is empty.
Variables ¶
var ErrDatabaseNil = fmt.Errorf("database cannot be nil")
Error when trying to use nil database in this module.
Functions ¶
func AddTag ¶
Add tags to given LazyDB. This function support multiple tags insert at once.
If tag value is empty string, then it will be skipped.
func GetAllTags ¶
Get all tags from given LazyDB.
func GetGenreList ¶
Get all genre value that from database.
func GetPublisherList ¶
Get all publisher value that from database.
func InsertGenre ¶
Insert genre value from database.
func InsertMultiHistory ¶
func InsertMultiHistory(db *lazydb.LazyDB, values ...HistoryVal) error
Insert values to database, which can include multiple record with different categories.
The string values & category values should be wrapped in `HistoryObj`.
If any error is occur during insert, the insert process will stop and return its error.
Types ¶
type HistoryVal ¶
type HistoryVal struct {
Category definitions.CategoryType // category to be inserted
Value string // value to be inserted
}
Container for history module, which wraps all necessary value will be used to insert value.
This type is designed for insert value with different category at a time.