diff options
Diffstat (limited to 'database.go')
-rw-r--r-- | database.go | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/database.go b/database.go index 0e53142..1b2ec3d 100644 --- a/database.go +++ b/database.go @@ -1649,3 +1649,29 @@ func DeleteRegexBlacklistDB(db *sql.DB, id int) { CheckError(err, "error with delete from postblacklist") } + +func GetActorAutoSubscribeDB(db *sql.DB, id string) bool{ + query := `select autosubscribe from actor where id=$1` + + rows, err:= db.Query(query, id) + + CheckError(err, "error with getting actor auto subscribe status from db") + + var subscribed bool + defer rows.Close() + rows.Next() + rows.Scan(&subscribed) + + + return subscribed +} + +func SetActorAutoSubscribeDB(db *sql.DB, id string) { + current := GetActorAutoSubscribeDB(db, id) + + query := `update actor set autosubscribe=$1 where id=$2` + + _, err := db.Exec(query, !current, id) + + CheckError(err, "error with set actor auto subscribe status from db") +} |