libfic: new function to get theme by name
This commit is contained in:
parent
8f7de926d3
commit
38606f28c7
@ -41,6 +41,15 @@ func GetTheme(id int) (Theme, error) {
|
||||
return t, nil
|
||||
}
|
||||
|
||||
func GetThemeByName(name string) (Theme, error) {
|
||||
var t Theme
|
||||
if err := DBQueryRow("SELECT id_theme, name, authors FROM themes WHERE name=?", name).Scan(&t.Id, &t.Name, &t.Authors); err != nil {
|
||||
return t, err
|
||||
}
|
||||
|
||||
return t, nil
|
||||
}
|
||||
|
||||
func CreateTheme(name string, authors string) (Theme, error) {
|
||||
if res, err := DBExec("INSERT INTO themes (name, authors) VALUES (?, ?)", name, authors); err != nil {
|
||||
return Theme{}, err
|
||||
|
Loading…
Reference in New Issue
Block a user