1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
package db
func IsIDLocal(id string) (bool, error) {
activity, err := GetActivityFromDB(id)
return len(activity.OrderedItems) > 0, err
}
func IsActorLocal(id string) (bool, error) {
actor, err := GetActorFromDB(id)
return actor.Id != "", err
}
func IsObjectLocal(id string) (bool, error) {
query := `select id from activitystream where id=$1`
rows, err := db.Query(query, id)
if err != nil {
return false, err
}
var nID string
defer rows.Close()
rows.Next()
err = rows.Scan(&nID)
return nID != "", err
}
func IsObjectCached(id string) (bool, error) {
query := `select id from cacheactivitystream where id=$1`
rows, err := db.Query(query, id)
if err != nil {
return false, err
}
var nID string
defer rows.Close()
rows.Next()
err = rows.Scan(&nID)
return nID != "", err
}
|