aboutsummaryrefslogtreecommitdiff
path: root/Database.go
diff options
context:
space:
mode:
authorFChannel <=>2021-01-24 10:59:49 -0800
committerFChannel <=>2021-01-24 10:59:49 -0800
commit895d90f8dd038540e65cf291f003195a0f6bd024 (patch)
treef8c9dcd4fc735cc1b9dc76866df8215c516abb8f /Database.go
parent2ca021e2c6599b39e6225fdbd449093517a34418 (diff)
domain routing bug
Diffstat (limited to 'Database.go')
-rw-r--r--Database.go22
1 files changed, 22 insertions, 0 deletions
diff --git a/Database.go b/Database.go
index 275bfcd..ea1b031 100644
--- a/Database.go
+++ b/Database.go
@@ -30,6 +30,28 @@ func GetActorFromDB(db *sql.DB, id string) Actor {
return nActor
}
+func GetActorByNameFromDB(db *sql.DB, name string) Actor {
+ var nActor Actor
+
+ query :=`select type, id, name, preferedusername, inbox, outbox, following, followers, restricted, summary from actor where name=$1`
+
+ rows, err := db.Query(query, name)
+
+ if CheckError(err, "could not get actor from db query") != nil {
+ return nActor
+ }
+
+ defer rows.Close()
+ for rows.Next() {
+ err = rows.Scan(&nActor.Type, &nActor.Id, &nActor.Name, &nActor.PreferredUsername, &nActor.Inbox, &nActor.Outbox, &nActor.Following, &nActor.Followers, &nActor.Restricted, &nActor.Summary)
+ CheckError(err, "error with actor from db scan ")
+ }
+
+ nActor.AtContext.Context = "https://www.w3.org/ns/activitystreams"
+
+ return nActor
+}
+
func CreateNewBoardDB(db *sql.DB, actor Actor) Actor{
query := `insert into actor (type, id, name, preferedusername, inbox, outbox, following, followers, summary) values ($1, $2, $3, $4, $5, $6, $7, $8, $9)`