This repository has no description
0

Configure Feed

Select the types of activity you want to include in your feed.

core / appview / db / theme.go
812 B 32 lines
1package db 2 3import ( 4 "database/sql" 5 6 "tangled.org/core/appview/models" 7) 8 9func GetThemePreference(e Execer, did string) (models.ThemePreference, error) { 10 var theme string 11 err := e.QueryRow( 12 `select theme from theme_preferences where user_did = ?`, 13 did, 14 ).Scan(&theme) 15 if err == sql.ErrNoRows { 16 return models.ThemePreference(models.ThemeAuto), nil 17 } 18 if err != nil { 19 return "", err 20 } 21 return models.ThemePreference(theme), nil 22} 23 24func UpsertThemePreference(e Execer, did string, theme models.ThemePreference) error { 25 _, err := e.Exec( 26 `insert into theme_preferences (user_did, theme, updated_at) values (?, ?, strftime('%Y-%m-%dT%H:%M:%SZ', 'now')) 27 on conflict(user_did) do update set theme = excluded.theme, updated_at = excluded.updated_at`, 28 did, 29 string(theme), 30 ) 31 return err 32}