mirror of https://gitlab.com/ngerakines/tavern.git
Finished filling in vague errors in storage. Moved several queries from web into storage. Closes #51.
This commit is contained in:
parent
5fc29fb402
commit
18c0270ef9
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -6,124 +6,132 @@
|
|||
6 ,TAVDAT,DeleteQueryFailed ,The delete query failed ,QueryFailed
|
||||
|
||||
# The following was generated by storage_crud.go
|
||||
# go run errors/storage_crud.go 7 User UserSession UserFeed UserObjectEvent Actor ActorAlias ActorKey NetworkRelationship Object ObjectEvent ObjectReply ObjectThread ObjectBoost Image ImageAlias
|
||||
7 ,TAVDAT,UserQueryFailed ,The user query failed. ,QueryFailed
|
||||
8 ,TAVDAT,UserSelectFailed ,The select record operation for user failed. ,SelectQueryFailed
|
||||
9 ,TAVDAT,UserInsertFailed ,The insert record operation for user failed. ,InsertQueryFailed
|
||||
10 ,TAVDAT,UserUpsertFailed ,The upsert record operation for user failed. ,QueryFailed
|
||||
11 ,TAVDAT,UserUpdateFailed ,The update record operation for user failed. ,UpdateQueryFailed
|
||||
12 ,TAVDAT,UserDeleteFailed ,The delete record operation for user failed. ,DeleteQueryFailed
|
||||
13 ,TAVDAT,InvalidUser ,The user is invalid.
|
||||
14 ,TAVDAT,UserNotFound ,The user was not found. ,NotFound
|
||||
15 ,TAVDAT,UserSessionQueryFailed ,The user session query failed. ,QueryFailed
|
||||
16 ,TAVDAT,UserSessionSelectFailed ,The select record operation for user session failed. ,SelectQueryFailed
|
||||
17 ,TAVDAT,UserSessionInsertFailed ,The insert record operation for user session failed. ,InsertQueryFailed
|
||||
18 ,TAVDAT,UserSessionUpsertFailed ,The upsert record operation for user session failed. ,QueryFailed
|
||||
19 ,TAVDAT,UserSessionUpdateFailed ,The update record operation for user session failed. ,UpdateQueryFailed
|
||||
20 ,TAVDAT,UserSessionDeleteFailed ,The delete record operation for user session failed. ,DeleteQueryFailed
|
||||
21 ,TAVDAT,InvalidUserSession ,The user session is invalid.
|
||||
22 ,TAVDAT,UserSessionNotFound ,The user session was not found. ,NotFound
|
||||
23 ,TAVDAT,UserFeedQueryFailed ,The user feed query failed. ,QueryFailed
|
||||
24 ,TAVDAT,UserFeedSelectFailed ,The select record operation for user feed failed. ,SelectQueryFailed
|
||||
25 ,TAVDAT,UserFeedInsertFailed ,The insert record operation for user feed failed. ,InsertQueryFailed
|
||||
26 ,TAVDAT,UserFeedUpsertFailed ,The upsert record operation for user feed failed. ,QueryFailed
|
||||
27 ,TAVDAT,UserFeedUpdateFailed ,The update record operation for user feed failed. ,UpdateQueryFailed
|
||||
28 ,TAVDAT,UserFeedDeleteFailed ,The delete record operation for user feed failed. ,DeleteQueryFailed
|
||||
29 ,TAVDAT,InvalidUserFeed ,The user feed is invalid.
|
||||
30 ,TAVDAT,UserFeedNotFound ,The user feed was not found. ,NotFound
|
||||
31 ,TAVDAT,UserObjectEventQueryFailed ,The user object event query failed. ,QueryFailed
|
||||
32 ,TAVDAT,UserObjectEventSelectFailed ,The select record operation for user object event failed. ,SelectQueryFailed
|
||||
33 ,TAVDAT,UserObjectEventInsertFailed ,The insert record operation for user object event failed. ,InsertQueryFailed
|
||||
34 ,TAVDAT,UserObjectEventUpsertFailed ,The upsert record operation for user object event failed. ,QueryFailed
|
||||
35 ,TAVDAT,UserObjectEventUpdateFailed ,The update record operation for user object event failed. ,UpdateQueryFailed
|
||||
36 ,TAVDAT,UserObjectEventDeleteFailed ,The delete record operation for user object event failed. ,DeleteQueryFailed
|
||||
37 ,TAVDAT,InvalidUserObjectEvent ,The user object event is invalid.
|
||||
38 ,TAVDAT,UserObjectEventNotFound ,The user object event was not found. ,NotFound
|
||||
39 ,TAVDAT,ActorQueryFailed ,The actor query failed. ,QueryFailed
|
||||
40 ,TAVDAT,ActorSelectFailed ,The select record operation for actor failed. ,SelectQueryFailed
|
||||
41 ,TAVDAT,ActorInsertFailed ,The insert record operation for actor failed. ,InsertQueryFailed
|
||||
42 ,TAVDAT,ActorUpsertFailed ,The upsert record operation for actor failed. ,QueryFailed
|
||||
43 ,TAVDAT,ActorUpdateFailed ,The update record operation for actor failed. ,UpdateQueryFailed
|
||||
44 ,TAVDAT,ActorDeleteFailed ,The delete record operation for actor failed. ,DeleteQueryFailed
|
||||
45 ,TAVDAT,InvalidActor ,The actor is invalid.
|
||||
46 ,TAVDAT,ActorNotFound ,The actor was not found. ,NotFound
|
||||
47 ,TAVDAT,ActorAliasQueryFailed ,The actor alias query failed. ,QueryFailed
|
||||
48 ,TAVDAT,ActorAliasSelectFailed ,The select record operation for actor alias failed. ,SelectQueryFailed
|
||||
49 ,TAVDAT,ActorAliasInsertFailed ,The insert record operation for actor alias failed. ,InsertQueryFailed
|
||||
50 ,TAVDAT,ActorAliasUpsertFailed ,The upsert record operation for actor alias failed. ,QueryFailed
|
||||
51 ,TAVDAT,ActorAliasUpdateFailed ,The update record operation for actor alias failed. ,UpdateQueryFailed
|
||||
52 ,TAVDAT,ActorAliasDeleteFailed ,The delete record operation for actor alias failed. ,DeleteQueryFailed
|
||||
53 ,TAVDAT,InvalidActorAlias ,The actor alias is invalid.
|
||||
54 ,TAVDAT,ActorAliasNotFound ,The actor alias was not found. ,NotFound
|
||||
55 ,TAVDAT,ActorKeyQueryFailed ,The actor key query failed. ,QueryFailed
|
||||
56 ,TAVDAT,ActorKeySelectFailed ,The select record operation for actor key failed. ,SelectQueryFailed
|
||||
57 ,TAVDAT,ActorKeyInsertFailed ,The insert record operation for actor key failed. ,InsertQueryFailed
|
||||
58 ,TAVDAT,ActorKeyUpsertFailed ,The upsert record operation for actor key failed. ,QueryFailed
|
||||
59 ,TAVDAT,ActorKeyUpdateFailed ,The update record operation for actor key failed. ,UpdateQueryFailed
|
||||
60 ,TAVDAT,ActorKeyDeleteFailed ,The delete record operation for actor key failed. ,DeleteQueryFailed
|
||||
61 ,TAVDAT,InvalidActorKey ,The actor key is invalid.
|
||||
62 ,TAVDAT,ActorKeyNotFound ,The actor key was not found. ,NotFound
|
||||
63 ,TAVDAT,NetworkRelationshipQueryFailed ,The network relationship query failed. ,QueryFailed
|
||||
64 ,TAVDAT,NetworkRelationshipSelectFailed,The select record operation for network relationship failed.,SelectQueryFailed
|
||||
65 ,TAVDAT,NetworkRelationshipInsertFailed,The insert record operation for network relationship failed.,InsertQueryFailed
|
||||
66 ,TAVDAT,NetworkRelationshipUpsertFailed,The upsert record operation for network relationship failed.,QueryFailed
|
||||
67 ,TAVDAT,NetworkRelationshipUpdateFailed,The update record operation for network relationship failed.,UpdateQueryFailed
|
||||
68 ,TAVDAT,NetworkRelationshipDeleteFailed,The delete record operation for network relationship failed.,DeleteQueryFailed
|
||||
69 ,TAVDAT,InvalidNetworkRelationship ,The network relationship is invalid.
|
||||
70 ,TAVDAT,NetworkRelationshipNotFound ,The network relationship was not found. ,NotFound
|
||||
71 ,TAVDAT,ObjectQueryFailed ,The object query failed. ,QueryFailed
|
||||
72 ,TAVDAT,ObjectSelectFailed ,The select record operation for object failed. ,SelectQueryFailed
|
||||
73 ,TAVDAT,ObjectInsertFailed ,The insert record operation for object failed. ,InsertQueryFailed
|
||||
74 ,TAVDAT,ObjectUpsertFailed ,The upsert record operation for object failed. ,QueryFailed
|
||||
75 ,TAVDAT,ObjectUpdateFailed ,The update record operation for object failed. ,UpdateQueryFailed
|
||||
76 ,TAVDAT,ObjectDeleteFailed ,The delete record operation for object failed. ,DeleteQueryFailed
|
||||
77 ,TAVDAT,InvalidObject ,The object is invalid.
|
||||
78 ,TAVDAT,ObjectNotFound ,The object was not found. ,NotFound
|
||||
79 ,TAVDAT,ObjectEventQueryFailed ,The object event query failed. ,QueryFailed
|
||||
80 ,TAVDAT,ObjectEventSelectFailed ,The select record operation for object event failed. ,SelectQueryFailed
|
||||
81 ,TAVDAT,ObjectEventInsertFailed ,The insert record operation for object event failed. ,InsertQueryFailed
|
||||
82 ,TAVDAT,ObjectEventUpsertFailed ,The upsert record operation for object event failed. ,QueryFailed
|
||||
83 ,TAVDAT,ObjectEventUpdateFailed ,The update record operation for object event failed. ,UpdateQueryFailed
|
||||
84 ,TAVDAT,ObjectEventDeleteFailed ,The delete record operation for object event failed. ,DeleteQueryFailed
|
||||
85 ,TAVDAT,InvalidObjectEvent ,The object event is invalid.
|
||||
86 ,TAVDAT,ObjectEventNotFound ,The object event was not found. ,NotFound
|
||||
87 ,TAVDAT,ObjectReplyQueryFailed ,The object reply query failed. ,QueryFailed
|
||||
88 ,TAVDAT,ObjectReplySelectFailed ,The select record operation for object reply failed. ,SelectQueryFailed
|
||||
89 ,TAVDAT,ObjectReplyInsertFailed ,The insert record operation for object reply failed. ,InsertQueryFailed
|
||||
90 ,TAVDAT,ObjectReplyUpsertFailed ,The upsert record operation for object reply failed. ,QueryFailed
|
||||
91 ,TAVDAT,ObjectReplyUpdateFailed ,The update record operation for object reply failed. ,UpdateQueryFailed
|
||||
92 ,TAVDAT,ObjectReplyDeleteFailed ,The delete record operation for object reply failed. ,DeleteQueryFailed
|
||||
93 ,TAVDAT,InvalidObjectReply ,The object reply is invalid.
|
||||
94 ,TAVDAT,ObjectReplyNotFound ,The object reply was not found. ,NotFound
|
||||
95 ,TAVDAT,ObjectThreadQueryFailed ,The object thread query failed. ,QueryFailed
|
||||
96 ,TAVDAT,ObjectThreadSelectFailed ,The select record operation for object thread failed. ,SelectQueryFailed
|
||||
97 ,TAVDAT,ObjectThreadInsertFailed ,The insert record operation for object thread failed. ,InsertQueryFailed
|
||||
98 ,TAVDAT,ObjectThreadUpsertFailed ,The upsert record operation for object thread failed. ,QueryFailed
|
||||
99 ,TAVDAT,ObjectThreadUpdateFailed ,The update record operation for object thread failed. ,UpdateQueryFailed
|
||||
100,TAVDAT,ObjectThreadDeleteFailed ,The delete record operation for object thread failed. ,DeleteQueryFailed
|
||||
101,TAVDAT,InvalidObjectThread ,The object thread is invalid.
|
||||
102,TAVDAT,ObjectThreadNotFound ,The object thread was not found. ,NotFound
|
||||
103,TAVDAT,ObjectBoostQueryFailed ,The object boost query failed. ,QueryFailed
|
||||
104,TAVDAT,ObjectBoostSelectFailed ,The select record operation for object boost failed. ,SelectQueryFailed
|
||||
105,TAVDAT,ObjectBoostInsertFailed ,The insert record operation for object boost failed. ,InsertQueryFailed
|
||||
106,TAVDAT,ObjectBoostUpsertFailed ,The upsert record operation for object boost failed. ,QueryFailed
|
||||
107,TAVDAT,ObjectBoostUpdateFailed ,The update record operation for object boost failed. ,UpdateQueryFailed
|
||||
108,TAVDAT,ObjectBoostDeleteFailed ,The delete record operation for object boost failed. ,DeleteQueryFailed
|
||||
109,TAVDAT,InvalidObjectBoost ,The object boost is invalid.
|
||||
110,TAVDAT,ObjectBoostNotFound ,The object boost was not found. ,NotFound
|
||||
111,TAVDAT,ImageQueryFailed ,The image query failed. ,QueryFailed
|
||||
112,TAVDAT,ImageSelectFailed ,The select record operation for image failed. ,SelectQueryFailed
|
||||
113,TAVDAT,ImageInsertFailed ,The insert record operation for image failed. ,InsertQueryFailed
|
||||
114,TAVDAT,ImageUpsertFailed ,The upsert record operation for image failed. ,QueryFailed
|
||||
115,TAVDAT,ImageUpdateFailed ,The update record operation for image failed. ,UpdateQueryFailed
|
||||
116,TAVDAT,ImageDeleteFailed ,The delete record operation for image failed. ,DeleteQueryFailed
|
||||
117,TAVDAT,InvalidImage ,The image is invalid.
|
||||
118,TAVDAT,ImageNotFound ,The image was not found. ,NotFound
|
||||
119,TAVDAT,ImageAliasQueryFailed ,The image alias query failed. ,QueryFailed
|
||||
120,TAVDAT,ImageAliasSelectFailed ,The select record operation for image alias failed. ,SelectQueryFailed
|
||||
121,TAVDAT,ImageAliasInsertFailed ,The insert record operation for image alias failed. ,InsertQueryFailed
|
||||
122,TAVDAT,ImageAliasUpsertFailed ,The upsert record operation for image alias failed. ,QueryFailed
|
||||
123,TAVDAT,ImageAliasUpdateFailed ,The update record operation for image alias failed. ,UpdateQueryFailed
|
||||
124,TAVDAT,ImageAliasDeleteFailed ,The delete record operation for image alias failed. ,DeleteQueryFailed
|
||||
125,TAVDAT,InvalidImageAlias ,The image alias is invalid.
|
||||
126,TAVDAT,ImageAliasNotFound ,The image alias was not found. ,NotFound
|
||||
# go run errors/storage_crud.go 7 User UserSession UserFeed UserObjectEvent Actor ActorAlias ActorKey NetworkRelationship Object ObjectEvent ObjectReply ObjectTag ObjectThread ObjectBoost Image ImageAlias
|
||||
7,TAVDAT,UserQueryFailed,The user query failed.,QueryFailed
|
||||
8,TAVDAT,UserSelectFailed,The select record operation for user failed.,SelectQueryFailed
|
||||
9,TAVDAT,UserInsertFailed,The insert record operation for user failed.,InsertQueryFailed
|
||||
10,TAVDAT,UserUpsertFailed,The upsert record operation for user failed.,QueryFailed
|
||||
11,TAVDAT,UserUpdateFailed,The update record operation for user failed.,UpdateQueryFailed
|
||||
12,TAVDAT,UserDeleteFailed,The delete record operation for user failed.,DeleteQueryFailed
|
||||
13,TAVDAT,InvalidUser,The user is invalid.
|
||||
14,TAVDAT,UserNotFound,The user was not found.,NotFound
|
||||
15,TAVDAT,UserSessionQueryFailed,The user session query failed.,QueryFailed
|
||||
16,TAVDAT,UserSessionSelectFailed,The select record operation for user session failed.,SelectQueryFailed
|
||||
17,TAVDAT,UserSessionInsertFailed,The insert record operation for user session failed.,InsertQueryFailed
|
||||
18,TAVDAT,UserSessionUpsertFailed,The upsert record operation for user session failed.,QueryFailed
|
||||
19,TAVDAT,UserSessionUpdateFailed,The update record operation for user session failed.,UpdateQueryFailed
|
||||
20,TAVDAT,UserSessionDeleteFailed,The delete record operation for user session failed.,DeleteQueryFailed
|
||||
21,TAVDAT,InvalidUserSession,The user session is invalid.
|
||||
22,TAVDAT,UserSessionNotFound,The user session was not found.,NotFound
|
||||
23,TAVDAT,UserFeedQueryFailed,The user feed query failed.,QueryFailed
|
||||
24,TAVDAT,UserFeedSelectFailed,The select record operation for user feed failed.,SelectQueryFailed
|
||||
25,TAVDAT,UserFeedInsertFailed,The insert record operation for user feed failed.,InsertQueryFailed
|
||||
26,TAVDAT,UserFeedUpsertFailed,The upsert record operation for user feed failed.,QueryFailed
|
||||
27,TAVDAT,UserFeedUpdateFailed,The update record operation for user feed failed.,UpdateQueryFailed
|
||||
28,TAVDAT,UserFeedDeleteFailed,The delete record operation for user feed failed.,DeleteQueryFailed
|
||||
29,TAVDAT,InvalidUserFeed,The user feed is invalid.
|
||||
30,TAVDAT,UserFeedNotFound,The user feed was not found.,NotFound
|
||||
31,TAVDAT,UserObjectEventQueryFailed,The user object event query failed.,QueryFailed
|
||||
32,TAVDAT,UserObjectEventSelectFailed,The select record operation for user object event failed.,SelectQueryFailed
|
||||
33,TAVDAT,UserObjectEventInsertFailed,The insert record operation for user object event failed.,InsertQueryFailed
|
||||
34,TAVDAT,UserObjectEventUpsertFailed,The upsert record operation for user object event failed.,QueryFailed
|
||||
35,TAVDAT,UserObjectEventUpdateFailed,The update record operation for user object event failed.,UpdateQueryFailed
|
||||
36,TAVDAT,UserObjectEventDeleteFailed,The delete record operation for user object event failed.,DeleteQueryFailed
|
||||
37,TAVDAT,InvalidUserObjectEvent,The user object event is invalid.
|
||||
38,TAVDAT,UserObjectEventNotFound,The user object event was not found.,NotFound
|
||||
39,TAVDAT,ActorQueryFailed,The actor query failed.,QueryFailed
|
||||
40,TAVDAT,ActorSelectFailed,The select record operation for actor failed.,SelectQueryFailed
|
||||
41,TAVDAT,ActorInsertFailed,The insert record operation for actor failed.,InsertQueryFailed
|
||||
42,TAVDAT,ActorUpsertFailed,The upsert record operation for actor failed.,QueryFailed
|
||||
43,TAVDAT,ActorUpdateFailed,The update record operation for actor failed.,UpdateQueryFailed
|
||||
44,TAVDAT,ActorDeleteFailed,The delete record operation for actor failed.,DeleteQueryFailed
|
||||
45,TAVDAT,InvalidActor,The actor is invalid.
|
||||
46,TAVDAT,ActorNotFound,The actor was not found.,NotFound
|
||||
47,TAVDAT,ActorAliasQueryFailed,The actor alias query failed.,QueryFailed
|
||||
48,TAVDAT,ActorAliasSelectFailed,The select record operation for actor alias failed.,SelectQueryFailed
|
||||
49,TAVDAT,ActorAliasInsertFailed,The insert record operation for actor alias failed.,InsertQueryFailed
|
||||
50,TAVDAT,ActorAliasUpsertFailed,The upsert record operation for actor alias failed.,QueryFailed
|
||||
51,TAVDAT,ActorAliasUpdateFailed,The update record operation for actor alias failed.,UpdateQueryFailed
|
||||
52,TAVDAT,ActorAliasDeleteFailed,The delete record operation for actor alias failed.,DeleteQueryFailed
|
||||
53,TAVDAT,InvalidActorAlias,The actor alias is invalid.
|
||||
54,TAVDAT,ActorAliasNotFound,The actor alias was not found.,NotFound
|
||||
55,TAVDAT,ActorKeyQueryFailed,The actor key query failed.,QueryFailed
|
||||
56,TAVDAT,ActorKeySelectFailed,The select record operation for actor key failed.,SelectQueryFailed
|
||||
57,TAVDAT,ActorKeyInsertFailed,The insert record operation for actor key failed.,InsertQueryFailed
|
||||
58,TAVDAT,ActorKeyUpsertFailed,The upsert record operation for actor key failed.,QueryFailed
|
||||
59,TAVDAT,ActorKeyUpdateFailed,The update record operation for actor key failed.,UpdateQueryFailed
|
||||
60,TAVDAT,ActorKeyDeleteFailed,The delete record operation for actor key failed.,DeleteQueryFailed
|
||||
61,TAVDAT,InvalidActorKey,The actor key is invalid.
|
||||
62,TAVDAT,ActorKeyNotFound,The actor key was not found.,NotFound
|
||||
63,TAVDAT,NetworkRelationshipQueryFailed,The network relationship query failed.,QueryFailed
|
||||
64,TAVDAT,NetworkRelationshipSelectFailed,The select record operation for network relationship failed.,SelectQueryFailed
|
||||
65,TAVDAT,NetworkRelationshipInsertFailed,The insert record operation for network relationship failed.,InsertQueryFailed
|
||||
66,TAVDAT,NetworkRelationshipUpsertFailed,The upsert record operation for network relationship failed.,QueryFailed
|
||||
67,TAVDAT,NetworkRelationshipUpdateFailed,The update record operation for network relationship failed.,UpdateQueryFailed
|
||||
68,TAVDAT,NetworkRelationshipDeleteFailed,The delete record operation for network relationship failed.,DeleteQueryFailed
|
||||
69,TAVDAT,InvalidNetworkRelationship,The network relationship is invalid.
|
||||
70,TAVDAT,NetworkRelationshipNotFound,The network relationship was not found.,NotFound
|
||||
71,TAVDAT,ObjectQueryFailed,The object query failed.,QueryFailed
|
||||
72,TAVDAT,ObjectSelectFailed,The select record operation for object failed.,SelectQueryFailed
|
||||
73,TAVDAT,ObjectInsertFailed,The insert record operation for object failed.,InsertQueryFailed
|
||||
74,TAVDAT,ObjectUpsertFailed,The upsert record operation for object failed.,QueryFailed
|
||||
75,TAVDAT,ObjectUpdateFailed,The update record operation for object failed.,UpdateQueryFailed
|
||||
76,TAVDAT,ObjectDeleteFailed,The delete record operation for object failed.,DeleteQueryFailed
|
||||
77,TAVDAT,InvalidObject,The object is invalid.
|
||||
78,TAVDAT,ObjectNotFound,The object was not found.,NotFound
|
||||
79,TAVDAT,ObjectEventQueryFailed,The object event query failed.,QueryFailed
|
||||
80,TAVDAT,ObjectEventSelectFailed,The select record operation for object event failed.,SelectQueryFailed
|
||||
81,TAVDAT,ObjectEventInsertFailed,The insert record operation for object event failed.,InsertQueryFailed
|
||||
82,TAVDAT,ObjectEventUpsertFailed,The upsert record operation for object event failed.,QueryFailed
|
||||
83,TAVDAT,ObjectEventUpdateFailed,The update record operation for object event failed.,UpdateQueryFailed
|
||||
84,TAVDAT,ObjectEventDeleteFailed,The delete record operation for object event failed.,DeleteQueryFailed
|
||||
85,TAVDAT,InvalidObjectEvent,The object event is invalid.
|
||||
86,TAVDAT,ObjectEventNotFound,The object event was not found.,NotFound
|
||||
87,TAVDAT,ObjectReplyQueryFailed,The object reply query failed.,QueryFailed
|
||||
88,TAVDAT,ObjectReplySelectFailed,The select record operation for object reply failed.,SelectQueryFailed
|
||||
89,TAVDAT,ObjectReplyInsertFailed,The insert record operation for object reply failed.,InsertQueryFailed
|
||||
90,TAVDAT,ObjectReplyUpsertFailed,The upsert record operation for object reply failed.,QueryFailed
|
||||
91,TAVDAT,ObjectReplyUpdateFailed,The update record operation for object reply failed.,UpdateQueryFailed
|
||||
92,TAVDAT,ObjectReplyDeleteFailed,The delete record operation for object reply failed.,DeleteQueryFailed
|
||||
93,TAVDAT,InvalidObjectReply,The object reply is invalid.
|
||||
94,TAVDAT,ObjectReplyNotFound,The object reply was not found.,NotFound
|
||||
95,TAVDAT,ObjectTagQueryFailed,The object tag query failed.,QueryFailed
|
||||
96,TAVDAT,ObjectTagSelectFailed,The select record operation for object tag failed.,SelectQueryFailed
|
||||
97,TAVDAT,ObjectTagInsertFailed,The insert record operation for object tag failed.,InsertQueryFailed
|
||||
98,TAVDAT,ObjectTagUpsertFailed,The upsert record operation for object tag failed.,QueryFailed
|
||||
99,TAVDAT,ObjectTagUpdateFailed,The update record operation for object tag failed.,UpdateQueryFailed
|
||||
100,TAVDAT,ObjectTagDeleteFailed,The delete record operation for object tag failed.,DeleteQueryFailed
|
||||
101,TAVDAT,InvalidObjectTag,The object tag is invalid.
|
||||
102,TAVDAT,ObjectTagNotFound,The object tag was not found.,NotFound
|
||||
103,TAVDAT,ObjectThreadQueryFailed,The object thread query failed.,QueryFailed
|
||||
104,TAVDAT,ObjectThreadSelectFailed,The select record operation for object thread failed.,SelectQueryFailed
|
||||
105,TAVDAT,ObjectThreadInsertFailed,The insert record operation for object thread failed.,InsertQueryFailed
|
||||
106,TAVDAT,ObjectThreadUpsertFailed,The upsert record operation for object thread failed.,QueryFailed
|
||||
107,TAVDAT,ObjectThreadUpdateFailed,The update record operation for object thread failed.,UpdateQueryFailed
|
||||
108,TAVDAT,ObjectThreadDeleteFailed,The delete record operation for object thread failed.,DeleteQueryFailed
|
||||
109,TAVDAT,InvalidObjectThread,The object thread is invalid.
|
||||
110,TAVDAT,ObjectThreadNotFound,The object thread was not found.,NotFound
|
||||
111,TAVDAT,ObjectBoostQueryFailed,The object boost query failed.,QueryFailed
|
||||
112,TAVDAT,ObjectBoostSelectFailed,The select record operation for object boost failed.,SelectQueryFailed
|
||||
113,TAVDAT,ObjectBoostInsertFailed,The insert record operation for object boost failed.,InsertQueryFailed
|
||||
114,TAVDAT,ObjectBoostUpsertFailed,The upsert record operation for object boost failed.,QueryFailed
|
||||
115,TAVDAT,ObjectBoostUpdateFailed,The update record operation for object boost failed.,UpdateQueryFailed
|
||||
116,TAVDAT,ObjectBoostDeleteFailed,The delete record operation for object boost failed.,DeleteQueryFailed
|
||||
117,TAVDAT,InvalidObjectBoost,The object boost is invalid.
|
||||
118,TAVDAT,ObjectBoostNotFound,The object boost was not found.,NotFound
|
||||
119,TAVDAT,ImageQueryFailed,The image query failed.,QueryFailed
|
||||
120,TAVDAT,ImageSelectFailed,The select record operation for image failed.,SelectQueryFailed
|
||||
121,TAVDAT,ImageInsertFailed,The insert record operation for image failed.,InsertQueryFailed
|
||||
122,TAVDAT,ImageUpsertFailed,The upsert record operation for image failed.,QueryFailed
|
||||
123,TAVDAT,ImageUpdateFailed,The update record operation for image failed.,UpdateQueryFailed
|
||||
124,TAVDAT,ImageDeleteFailed,The delete record operation for image failed.,DeleteQueryFailed
|
||||
125,TAVDAT,InvalidImage,The image is invalid.
|
||||
126,TAVDAT,ImageNotFound,The image was not found.,NotFound
|
||||
127,TAVDAT,ImageAliasQueryFailed,The image alias query failed.,QueryFailed
|
||||
128,TAVDAT,ImageAliasSelectFailed,The select record operation for image alias failed.,SelectQueryFailed
|
||||
129,TAVDAT,ImageAliasInsertFailed,The insert record operation for image alias failed.,InsertQueryFailed
|
||||
130,TAVDAT,ImageAliasUpsertFailed,The upsert record operation for image alias failed.,QueryFailed
|
||||
131,TAVDAT,ImageAliasUpdateFailed,The update record operation for image alias failed.,UpdateQueryFailed
|
||||
132,TAVDAT,ImageAliasDeleteFailed,The delete record operation for image alias failed.,DeleteQueryFailed
|
||||
133,TAVDAT,InvalidImageAlias,The image alias is invalid.
|
||||
134,TAVDAT,ImageAliasNotFound,The image alias was not found.,NotFound
|
|
|
@ -10,3 +10,5 @@ var (
|
|||
As = errors.As
|
||||
Unwrap = errors.Unwrap
|
||||
)
|
||||
|
||||
type ErrorWrapper func(error) error
|
|
@ -28,6 +28,7 @@ type ActorStorage interface {
|
|||
ActorRowIDForActorID(ctx context.Context, actorID string) (uuid.UUID, error)
|
||||
GetActorByAlias(ctx context.Context, subject string) (*Actor, error)
|
||||
ActorSubjects(ctx context.Context, actors []uuid.UUID) ([]ActorAlias, error)
|
||||
ActorAliasSubjectExists(ctx context.Context, alias string) (bool, error)
|
||||
}
|
||||
|
||||
type Actor struct {
|
||||
|
@ -331,3 +332,7 @@ func ActorFromUser(user *User, domain string, privateKey *rsa.PrivateKey) Payloa
|
|||
|
||||
return actor
|
||||
}
|
||||
|
||||
func (s pgStorage) ActorAliasSubjectExists(ctx context.Context, alias string) (bool, error) {
|
||||
return s.wrappedExists(errors.WrapActorAliasQueryFailedError, ctx, `SELECT COUNT(*) FROM actor_aliases WHERE alias = $1 AND alias_type = 0`, alias)
|
||||
}
|
||||
|
|
|
@ -55,7 +55,7 @@ func (s pgStorage) CreateImage(ctx context.Context, location, checksum, blur str
|
|||
txErr := runTransactionWithOptions(s.db, func(tx QueryExecute) error {
|
||||
checksumCount, err := s.rowCount(tx, ctx, `SELECT COUNT(*) FROM images WHERE checksum = $1`, checksum)
|
||||
if err != nil {
|
||||
return errors.WrapInsertQueryFailedError(err)
|
||||
return errors.WrapImageQueryFailedError(err)
|
||||
}
|
||||
if checksumCount > 0 {
|
||||
images, err := s.getImagesQuery(tx, ctx, `SELECT id, location, checksum, blur, size, content_type, height, width, '' FROM images WHERE checksum = $1`, checksum)
|
||||
|
@ -63,7 +63,7 @@ func (s pgStorage) CreateImage(ctx context.Context, location, checksum, blur str
|
|||
return err
|
||||
}
|
||||
if len(images) == 0 {
|
||||
return fmt.Errorf("count returned at least one but no results found")
|
||||
return errors.WrapImageQueryFailedError(fmt.Errorf("count returned at least one but no results found"))
|
||||
}
|
||||
img = images[0]
|
||||
return nil
|
||||
|
@ -72,16 +72,16 @@ func (s pgStorage) CreateImage(ctx context.Context, location, checksum, blur str
|
|||
imageRowID := NewV4()
|
||||
_, err = tx.ExecContext(ctx, `INSERT INTO images (id, location, checksum, content_type, blur, height, width, "size", created_at) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9)`, imageRowID, location, checksum, contentType, blur, height, width, size, now)
|
||||
if err != nil {
|
||||
return errors.WrapInsertQueryFailedError(err)
|
||||
return errors.WrapImageInsertFailedError(err)
|
||||
}
|
||||
for _, alias := range aliases {
|
||||
_, err = tx.ExecContext(ctx, `INSERT INTO image_aliases (id, image_id, alias, created_at) VALUES ($1, $2, $3, $4)`, NewV4(), imageRowID, alias, now)
|
||||
if err != nil {
|
||||
return errors.WrapInsertQueryFailedError(err)
|
||||
return errors.WrapImageAliasInsertFailedError(err)
|
||||
}
|
||||
}
|
||||
img, err = s.getImage(tx, ctx, imageRowID)
|
||||
return errors.WrapInsertQueryFailedError(err)
|
||||
return err
|
||||
})
|
||||
if txErr != nil {
|
||||
return ImageAsset{}, txErr
|
||||
|
@ -95,7 +95,7 @@ func (s pgStorage) GetImage(ctx context.Context, id uuid.UUID) (ImageAsset, erro
|
|||
return ImageAsset{}, err
|
||||
}
|
||||
if len(images) == 0 {
|
||||
return ImageAsset{}, errors.NewNotFoundError(nil)
|
||||
return ImageAsset{}, errors.NewImageNotFoundError(nil)
|
||||
}
|
||||
return images[0], nil
|
||||
}
|
||||
|
@ -106,7 +106,7 @@ func (s pgStorage) GetImageByChecksum(ctx context.Context, checksum string) (Ima
|
|||
return ImageAsset{}, err
|
||||
}
|
||||
if len(images) == 0 {
|
||||
return ImageAsset{}, errors.NewNotFoundError(nil)
|
||||
return ImageAsset{}, errors.NewImageNotFoundError(nil)
|
||||
}
|
||||
return images[0], nil
|
||||
}
|
||||
|
@ -117,7 +117,7 @@ func (s pgStorage) getImage(qc QueryExecute, ctx context.Context, id uuid.UUID)
|
|||
return ImageAsset{}, err
|
||||
}
|
||||
if len(images) == 0 {
|
||||
return ImageAsset{}, errors.NewNotFoundError(nil)
|
||||
return ImageAsset{}, errors.NewImageNotFoundError(nil)
|
||||
}
|
||||
return images[0], nil
|
||||
}
|
||||
|
@ -173,7 +173,7 @@ func (s pgStorage) getImagesQuery(qc QueryExecute, ctx context.Context, query st
|
|||
&imageAsset.Width,
|
||||
&imageAsset.Alias,
|
||||
); err != nil {
|
||||
return nil, errors.NewSelectQueryFailedError(err)
|
||||
return nil, errors.NewImageSelectFailedError(err)
|
||||
}
|
||||
results = append(results, imageAsset)
|
||||
}
|
||||
|
|
|
@ -0,0 +1,47 @@
|
|||
package storage
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/gofrs/uuid"
|
||||
|
||||
"github.com/ngerakines/tavern/errors"
|
||||
)
|
||||
|
||||
type InstanceStatsStorage interface {
|
||||
CountUserFollowers(ctx context.Context, userID uuid.UUID) (int, error)
|
||||
CountUserFollowing(ctx context.Context, userID uuid.UUID) (int, error)
|
||||
CountUsers(ctx context.Context) (int, error)
|
||||
CountUsersLastMonth(ctx context.Context) (int, error)
|
||||
CountUsersLastHalfYear(ctx context.Context) (int, error)
|
||||
CountObjectEvents(ctx context.Context) (int, error)
|
||||
CountUserObjectEvents(ctx context.Context, userID uuid.UUID) (int, error)
|
||||
}
|
||||
|
||||
func (s pgStorage) CountUserFollowers(ctx context.Context, userID uuid.UUID) (int, error) {
|
||||
return s.wrappedRowCount(errors.WrapNetworkRelationshipQueryFailedError, s.db, ctx, `SELECT COUNT(*) FROM network_graph WHERE user_id = $1 AND relationship_type = $2`, userID, UserFollowedByRelationship)
|
||||
}
|
||||
|
||||
func (s pgStorage) CountUserFollowing(ctx context.Context, userID uuid.UUID) (int, error) {
|
||||
return s.wrappedRowCount(errors.WrapNetworkRelationshipQueryFailedError, s.db, ctx, `SELECT COUNT(*) FROM network_graph WHERE user_id = $1 AND relationship_type = $2`, userID, UserFollowsRelationship)
|
||||
}
|
||||
|
||||
func (s pgStorage) CountUsers(ctx context.Context) (int, error) {
|
||||
return s.wrappedRowCount(errors.WrapUserQueryFailedError, s.db, ctx, `SELECT COUNT(*) FROM users`)
|
||||
}
|
||||
|
||||
func (s pgStorage) CountUsersLastMonth(ctx context.Context) (int, error) {
|
||||
return s.wrappedRowCount(errors.WrapUserQueryFailedError, s.db, ctx, `SELECT COUNT(*) FROM users WHERE last_auth_at > NOW() - INTERVAL '31 days'`)
|
||||
}
|
||||
|
||||
func (s pgStorage) CountUsersLastHalfYear(ctx context.Context) (int, error) {
|
||||
return s.wrappedRowCount(errors.WrapUserQueryFailedError, s.db, ctx, `SELECT COUNT(*) FROM users WHERE last_auth_at > NOW() - INTERVAL '183 days'`)
|
||||
}
|
||||
|
||||
func (s pgStorage) CountObjectEvents(ctx context.Context) (int, error) {
|
||||
return s.wrappedRowCount(errors.WrapObjectEventQueryFailedError, s.db, ctx, `SELECT COUNT(*) FROM user_object_events`)
|
||||
}
|
||||
|
||||
func (s pgStorage) CountUserObjectEvents(ctx context.Context, userID uuid.UUID) (int, error) {
|
||||
return s.wrappedRowCount(errors.WrapUserObjectEventQueryFailedError, s.db, ctx, `SELECT COUNT(*) FROM user_object_events WHERE user_id = $1`, userID)
|
||||
}
|
|
@ -87,7 +87,7 @@ func (s pgStorage) networkGraphQuery(qc QueryExecute, ctx context.Context, userI
|
|||
query := `SELECT a.actor_id FROM network_graph n INNER JOIN actors a ON a.id = n.actor_id WHERE n.user_id = $3 AND n.relationship_type = $4 AND n.relationship_status = $5 ORDER BY n.created_at ASC LIMIT $1 OFFSET $2`
|
||||
rows, err := qc.QueryContext(ctx, query, limit, offset, userID, relationshipType, relationshipStatus)
|
||||
if err != nil {
|
||||
return nil, errors.NewSelectQueryFailedError(err)
|
||||
return nil, errors.NewNetworkRelationshipSelectFailedError(err)
|
||||
}
|
||||
defer rows.Close()
|
||||
|
||||
|
@ -96,7 +96,7 @@ func (s pgStorage) networkGraphQuery(qc QueryExecute, ctx context.Context, userI
|
|||
for rows.Next() {
|
||||
var actor string
|
||||
if err := rows.Scan(&actor); err != nil {
|
||||
return nil, errors.NewSelectQueryFailedError(err)
|
||||
return nil, errors.NewNetworkRelationshipSelectFailedError(errors.NewInvalidNetworkRelationshipError(err))
|
||||
}
|
||||
actors = append(actors, actor)
|
||||
}
|
||||
|
@ -127,7 +127,7 @@ func (s pgStorage) createRelationshipGraphRecord(ec QueryExecute, ctx context.Co
|
|||
rowID := NewV4()
|
||||
now := s.now()
|
||||
_, err := s.db.ExecContext(ctx, query, rowID, userID, actorID, activity, relationshipType, relationshipStatus, now, now)
|
||||
return errors.WrapInsertQueryFailedError(err)
|
||||
return errors.WrapNetworkRelationshipInsertFailedError(err)
|
||||
}
|
||||
|
||||
func (s pgStorage) CreatePendingFollowing(ctx context.Context, userID, actorID uuid.UUID, activity Payload) error {
|
||||
|
@ -151,50 +151,50 @@ func (s pgStorage) networkGraphActivity(qc QueryExecute, ctx context.Context, us
|
|||
err := qc.QueryRowContext(ctx, `SELECT activity FROM network_graph WHERE user_id = $1 AND actor_id = $2 AND relationship_type = $3`, userID, actorID, relationshipType).
|
||||
Scan(&payload)
|
||||
if err != nil {
|
||||
return nil, errors.WrapQueryFailedError(err)
|
||||
return nil, errors.WrapNetworkRelationshipSelectFailedError(err)
|
||||
}
|
||||
return payload, nil
|
||||
}
|
||||
|
||||
func (s pgStorage) UpdateFollowingAccepted(ctx context.Context, userID, actorID uuid.UUID) error {
|
||||
_, err := s.db.ExecContext(ctx, `UPDATE network_graph SET relationship_status = $4 WHERE user_id = $1 AND actor_id = $2 AND relationship_type = $3`, userID, actorID, UserFollowsRelationship, AcceptRelationshipStatus)
|
||||
return errors.WrapUpdateQueryFailedError(err)
|
||||
return errors.WrapNetworkRelationshipUpdateFailedError(err)
|
||||
}
|
||||
|
||||
func (s pgStorage) UpdateFollowingRejected(ctx context.Context, userID, actorID uuid.UUID) error {
|
||||
_, err := s.db.ExecContext(ctx, `UPDATE network_graph SET relationship_status = $4 WHERE user_id = $1 AND actor_id = $2 AND relationship_type = $3`, userID, actorID, UserFollowsRelationship, RejectRelationshipStatus)
|
||||
return errors.WrapUpdateQueryFailedError(err)
|
||||
return errors.WrapNetworkRelationshipUpdateFailedError(err)
|
||||
}
|
||||
|
||||
func (s pgStorage) UpdateFollowerApproved(ctx context.Context, userID, actorID uuid.UUID) error {
|
||||
_, err := s.db.ExecContext(ctx, `UPDATE network_graph SET relationship_status = $4 WHERE user_id = $1 AND actor_id = $2 AND relationship_type = $3`, userID, actorID, UserFollowedByRelationship, AcceptRelationshipStatus)
|
||||
return errors.WrapUpdateQueryFailedError(err)
|
||||
return errors.WrapNetworkRelationshipUpdateFailedError(err)
|
||||
}
|
||||
|
||||
func (s pgStorage) RemoveFollowing(ctx context.Context, userID, actorID uuid.UUID) error {
|
||||
_, err := s.db.ExecContext(ctx, `DELETE FROM network_graph WHERE user_id = $1 AND actor_id = $2 AND relationship_type = $3`, userID, actorID, UserFollowsRelationship)
|
||||
return errors.WrapDeleteQueryFailedError(err)
|
||||
return errors.WrapNetworkRelationshipUpdateFailedError(err)
|
||||
}
|
||||
|
||||
func (s pgStorage) RemoveFollower(ctx context.Context, userID, actorID uuid.UUID) error {
|
||||
_, err := s.db.ExecContext(ctx, `DELETE FROM network_graph WHERE user_id = $1 AND actor_id = $2 AND relationship_type = $3`, userID, actorID, UserFollowedByRelationship)
|
||||
return errors.WrapDeleteQueryFailedError(err)
|
||||
return errors.WrapNetworkRelationshipUpdateFailedError(err)
|
||||
}
|
||||
|
||||
func (s pgStorage) IsFollowing(ctx context.Context, userID, actorID uuid.UUID) (bool, error) {
|
||||
c, err := s.RowCount(ctx, `SELECT COUNT(*) FROM network_graph WHERE user_id = $1 AND actor_id = $2 AND relationship_type = $3`, userID, actorID, UserFollowsRelationship)
|
||||
c, err := s.wrappedRowCount(errors.WrapNetworkRelationshipQueryFailedError, s.db, ctx, `SELECT COUNT(*) FROM network_graph WHERE user_id = $1 AND actor_id = $2 AND relationship_type = $3`, userID, actorID, UserFollowsRelationship)
|
||||
return c == 1, err
|
||||
}
|
||||
|
||||
func (s pgStorage) IsFollower(ctx context.Context, userID, actorID uuid.UUID) (bool, error) {
|
||||
c, err := s.RowCount(ctx, `SELECT COUNT(*) FROM network_graph WHERE user_id = $1 AND actor_id = $2 AND relationship_type = $3`, userID, actorID, UserFollowedByRelationship)
|
||||
c, err := s.wrappedRowCount(errors.WrapNetworkRelationshipQueryFailedError, s.db, ctx, `SELECT COUNT(*) FROM network_graph WHERE user_id = $1 AND actor_id = $2 AND relationship_type = $3`, userID, actorID, UserFollowedByRelationship)
|
||||
return c == 1, err
|
||||
}
|
||||
|
||||
func (s pgStorage) CountFollowers(ctx context.Context, userID uuid.UUID) (int, error) {
|
||||
return s.RowCount(ctx, `SELECT COUNT(*) FROM network_graph WHERE user_id = $1 AND relationship_type = $2`, userID, UserFollowedByRelationship)
|
||||
return s.wrappedRowCount(errors.WrapNetworkRelationshipQueryFailedError, s.db, ctx, `SELECT COUNT(*) FROM network_graph WHERE user_id = $1 AND relationship_type = $2`, userID, UserFollowedByRelationship)
|
||||
}
|
||||
|
||||
func (s pgStorage) CountFollowing(ctx context.Context, userID uuid.UUID) (int, error) {
|
||||
return s.RowCount(ctx, `SELECT COUNT(*) FROM network_graph WHERE user_id = $1 AND relationship_type = $2`, userID, UserFollowsRelationship)
|
||||
return s.wrappedRowCount(errors.WrapNetworkRelationshipQueryFailedError, s.db, ctx, `SELECT COUNT(*) FROM network_graph WHERE user_id = $1 AND relationship_type = $2`, userID, UserFollowsRelationship)
|
||||
}
|
||||
|
|
|
@ -66,7 +66,7 @@ func (s pgStorage) ListObjectPayloadsByObjectIDs(ctx context.Context, objectIDs
|
|||
}
|
||||
|
||||
func (s pgStorage) CountObjectEventPayloadsInFeed(ctx context.Context, userID uuid.UUID) (int, error) {
|
||||
return s.RowCount(ctx, `SELECT COUNT(oe.payload) FROM user_feed uf INNER JOIN object_events oe on oe.id = uf.activity_id WHERE uf.user_id = $1`, userID)
|
||||
return s.wrappedRowCount(errors.WrapObjectEventQueryFailedError, s.db, ctx, `SELECT COUNT(oe.payload) FROM user_feed uf INNER JOIN object_events oe on oe.id = uf.activity_id WHERE uf.user_id = $1`, userID)
|
||||
}
|
||||
|
||||
func (s pgStorage) ListObjectEventPayloadsInFeed(ctx context.Context, userID uuid.UUID, limit int, offset int) ([]Payload, error) {
|
||||
|
@ -75,7 +75,7 @@ func (s pgStorage) ListObjectEventPayloadsInFeed(ctx context.Context, userID uui
|
|||
}
|
||||
|
||||
func (s pgStorage) CountObjectEventPayloadsInUserFeed(ctx context.Context, userID uuid.UUID) (int, error) {
|
||||
return s.RowCount(ctx, `SELECT COUNT(*) FROM user_object_events uoe WHERE uoe.user_id = $1`, userID)
|
||||
return s.wrappedRowCount(errors.WrapObjectEventQueryFailedError, s.db, ctx, `SELECT COUNT(*) FROM user_object_events uoe WHERE uoe.user_id = $1`, userID)
|
||||
}
|
||||
|
||||
func (s pgStorage) ListObjectEventPayloadsInUserFeed(ctx context.Context, userID uuid.UUID, limit int, offset int) ([]Payload, error) {
|
||||
|
@ -84,7 +84,7 @@ func (s pgStorage) ListObjectEventPayloadsInUserFeed(ctx context.Context, userID
|
|||
}
|
||||
|
||||
func (s pgStorage) CountObjectPayloadsInLocalFeed(ctx context.Context) (int, error) {
|
||||
return s.RowCount(ctx, `SELECT COUNT(*) FROM user_object_events uoe WHERE uoe.public = true`)
|
||||
return s.wrappedRowCount(errors.WrapObjectQueryFailedError, s.db, ctx, `SELECT COUNT(*) FROM user_object_events uoe WHERE uoe.public = true`)
|
||||
}
|
||||
|
||||
func (s pgStorage) ListObjectPayloadsInLocalFeed(ctx context.Context, limit int, offset int) ([]Payload, error) {
|
||||
|
@ -94,7 +94,7 @@ func (s pgStorage) ListObjectPayloadsInLocalFeed(ctx context.Context, limit int,
|
|||
|
||||
func (s pgStorage) CountObjectPayloadsInTagFeed(ctx context.Context, tag string) (int, error) {
|
||||
query := `SELECT COUNT(o.payload) FROM user_object_events uoe INNER JOIN object_events oe on oe.id = uoe.activity_id INNER JOIN objects o on oe.object_id = o.id INNER JOIN object_tags ot on ot.object_id = o.id WHERE uoe.public = true AND ot.tag = $1`
|
||||
return s.RowCount(ctx, query, tag)
|
||||
return s.wrappedRowCount(errors.WrapObjectQueryFailedError, s.db, ctx, query, tag)
|
||||
}
|
||||
|
||||
func (s pgStorage) ListObjectPayloadsInTagFeed(ctx context.Context, tag string) ([]Payload, error) {
|
||||
|
@ -104,7 +104,7 @@ func (s pgStorage) ListObjectPayloadsInTagFeed(ctx context.Context, tag string)
|
|||
|
||||
func (s pgStorage) CountObjectPayloadsInObjectReplies(ctx context.Context, objectID uuid.UUID) (int, error) {
|
||||
query := `SELECT COUNT(o.payload) FROM objects o INNER JOIN object_replies r on o.id = r.object_id WHERE r.parent_object_id = $1`
|
||||
return s.rowCount(s.db, ctx, query, objectID)
|
||||
return s.wrappedRowCount(errors.WrapObjectQueryFailedError, s.db, ctx, query, objectID)
|
||||
}
|
||||
|
||||
func (s pgStorage) ListObjectPayloadsInObjectReplies(ctx context.Context, objectID uuid.UUID, limit int, offset int) ([]Payload, error) {
|
||||
|
@ -114,7 +114,7 @@ func (s pgStorage) ListObjectPayloadsInObjectReplies(ctx context.Context, object
|
|||
|
||||
func (s pgStorage) CountObjectPayloadsInUserOutbox(ctx context.Context, userID uuid.UUID) (int, error) {
|
||||
query := `SELECT COUNT(o.payload) FROM objects o INNER JOIN user_object_events uoe ON uoe.object_id = o.id WHERE uoe.user_id = $1 AND uoe.public = true`
|
||||
return s.rowCount(s.db, ctx, query, userID)
|
||||
return s.wrappedRowCount(errors.WrapObjectQueryFailedError, s.db, ctx, query, userID)
|
||||
}
|
||||
|
||||
func (s pgStorage) ListObjectPayloadsInUserOutbox(ctx context.Context, userID uuid.UUID, limit int, offset int) ([]Payload, error) {
|
||||
|
@ -123,7 +123,7 @@ func (s pgStorage) ListObjectPayloadsInUserOutbox(ctx context.Context, userID uu
|
|||
}
|
||||
|
||||
func (s pgStorage) CountObjectPayloadsInUserConversation(ctx context.Context, userID, threadID uuid.UUID) (int, error) {
|
||||
return s.RowCount(ctx, `SELECT COUNT(*) FROM user_conversations uc WHERE uc.user_id = $1 AND uc.thread_id = $2`, userID, threadID)
|
||||
return s.wrappedRowCount(errors.WrapObjectQueryFailedError, s.db, ctx, `SELECT COUNT(*) FROM user_conversations uc WHERE uc.user_id = $1 AND uc.thread_id = $2`, userID, threadID)
|
||||
}
|
||||
|
||||
func (s pgStorage) ListObjectPayloadsInUserConversation(ctx context.Context, userID, threadID uuid.UUID, limit, offset int) ([]Payload, error) {
|
||||
|
@ -141,13 +141,13 @@ func (s pgStorage) objectPayloads(ctx context.Context, query string, args ...int
|
|||
var results []Payload
|
||||
rows, err := s.db.QueryContext(ctx, query, args...)
|
||||
if err != nil {
|
||||
return nil, errors.NewSelectQueryFailedError(err)
|
||||
return nil, errors.NewObjectSelectFailedError(err)
|
||||
}
|
||||
defer rows.Close()
|
||||
for rows.Next() {
|
||||
var data Payload
|
||||
if err := rows.Scan(&data); err != nil {
|
||||
return nil, errors.NewSelectQueryFailedError(err)
|
||||
return nil, errors.NewInvalidObjectError(err)
|
||||
}
|
||||
results = append(results, data)
|
||||
}
|
||||
|
@ -165,10 +165,7 @@ func (s pgStorage) ObjectEventPayloadByActivityID(ctx context.Context, activityI
|
|||
func (s pgStorage) objectPayload(ctx context.Context, query string, args ...interface{}) (Payload, error) {
|
||||
var data Payload
|
||||
err := s.db.QueryRowContext(ctx, query, args...).Scan(&data)
|
||||
if err != nil {
|
||||
return nil, errors.NewSelectQueryFailedError(err)
|
||||
}
|
||||
return data, nil
|
||||
return data, errors.WrapObjectSelectFailedError(err)
|
||||
}
|
||||
|
||||
func (s pgStorage) RecordObject(ctx context.Context, payload Payload, objectID string) (uuid.UUID, error) {
|
||||
|
@ -181,7 +178,7 @@ func (s pgStorage) RecordObjectAll(ctx context.Context, rowID uuid.UUID, created
|
|||
query := `INSERT INTO objects (id, created_at, updated_at, payload, object_id) VALUES ($1, $2, $3, $4, $5) ON CONFLICT ON CONSTRAINT objects_object_uindex DO UPDATE SET updated_at = $2 RETURNING id`
|
||||
var id uuid.UUID
|
||||
err := s.db.QueryRowContext(ctx, query, rowID, createdAt, updatedAt, payload, objectID).Scan(&id)
|
||||
return id, errors.WrapInsertQueryFailedError(err)
|
||||
return id, errors.WrapObjectUpsertFailedError(err)
|
||||
}
|
||||
|
||||
func (s pgStorage) RecordObjectEvent(ctx context.Context, activityID string, objectID uuid.UUID, payload Payload) (uuid.UUID, error) {
|
||||
|
@ -194,7 +191,7 @@ func (s pgStorage) RecordObjectEventAll(ctx context.Context, rowID uuid.UUID, cr
|
|||
query := `INSERT INTO object_events (id, created_at, updated_at, activity_id, object_id, payload) VALUES ($1, $2, $3, $4, $5, $6) ON CONFLICT ON CONSTRAINT object_events_activity_uindex DO UPDATE SET updated_at = $3 RETURNING id`
|
||||
var id uuid.UUID
|
||||
err := s.db.QueryRowContext(ctx, query, rowID, createdAt, updatedAt, activityID, objectID, payload).Scan(&id)
|
||||
return id, errors.WrapInsertQueryFailedError(err)
|
||||
return id, errors.WrapObjectEventUpsertFailedError(err)
|
||||
}
|
||||
|
||||
func (s pgStorage) RecordUserObjectEvent(ctx context.Context, userID, activityID, objectID uuid.UUID, public bool) (uuid.UUID, error) {
|
||||
|
@ -207,7 +204,7 @@ func (s pgStorage) RecordUserObjectEventAll(ctx context.Context, rowID uuid.UUID
|
|||
query := `INSERT INTO user_object_events (id, created_at, updated_at, user_id, activity_id, object_id, public) VALUES ($1, $2, $3, $4, $5, $6, $7) ON CONFLICT ON CONSTRAINT user_object_events_user_activity_uindex DO UPDATE SET updated_at = $3 RETURNING id`
|
||||
var id uuid.UUID
|
||||
err := s.db.QueryRowContext(ctx, query, rowID, createdAt, updatedAt, userID, activityID, objectID, public).Scan(&id)
|
||||
return id, errors.WrapInsertQueryFailedError(err)
|
||||
return id, errors.WrapUserObjectEventUpsertFailedError(err)
|
||||
}
|
||||
|
||||
func (s pgStorage) RecordObjectTag(ctx context.Context, objectID uuid.UUID, tag string) (uuid.UUID, error) {
|
||||
|
@ -220,7 +217,7 @@ func (s pgStorage) RecordObjectTagAll(ctx context.Context, rowID uuid.UUID, crea
|
|||
query := `INSERT INTO object_tags (id, created_at, updated_at, object_id, tag) VALUES ($1, $2, $3, $4, $5) ON CONFLICT ON CONSTRAINT object_tags_tagged_uindex DO UPDATE SET updated_at = $3 RETURNING id`
|
||||
var id uuid.UUID
|
||||
err := s.db.QueryRowContext(ctx, query, rowID, createdAt, updatedAt, objectID, tag).Scan(&id)
|
||||
return id, errors.WrapInsertQueryFailedError(err)
|
||||
return id, errors.WrapObjectTagUpsertFailedError(err)
|
||||
}
|
||||
|
||||
func (s pgStorage) RecordUserFeed(ctx context.Context, activityID, objectID, userID uuid.UUID) (uuid.UUID, error) {
|
||||
|
@ -233,7 +230,7 @@ func (s pgStorage) RecordUserFeedAll(ctx context.Context, rowID uuid.UUID, creat
|
|||
query := `INSERT INTO user_feed (id, created_at, updated_at, activity_id, object_id, user_id) VALUES ($1, $2, $3, $4, $5, $6) ON CONFLICT ON CONSTRAINT user_feed_activity_uindex DO UPDATE SET updated_at = $3 RETURNING id`
|
||||
var id uuid.UUID
|
||||
err := s.db.QueryRowContext(ctx, query, rowID, createdAt, updatedAt, activityID, objectID, userID).Scan(&id)
|
||||
return id, errors.WrapInsertQueryFailedError(err)
|
||||
return id, errors.WrapUserFeedUpsertFailedError(err)
|
||||
}
|
||||
|
||||
func (s pgStorage) ObjectRowIDForObjectID(ctx context.Context, objectID string) (uuid.UUID, error) {
|
||||
|
@ -241,9 +238,9 @@ func (s pgStorage) ObjectRowIDForObjectID(ctx context.Context, objectID string)
|
|||
err := s.db.QueryRowContext(ctx, `SELECT id FROM objects WHERE object_id = $1`, objectID).Scan(&rowID)
|
||||
if err != nil {
|
||||
if err == sql.ErrNoRows {
|
||||
return uuid.Nil, errors.NewNotFoundError(err)
|
||||
return uuid.Nil, errors.NewObjectNotFoundError(errors.NewObjectQueryFailedError(err))
|
||||
}
|
||||
return uuid.Nil, errors.NewQueryFailedError(err)
|
||||
return uuid.Nil, errors.NewObjectQueryFailedError(err)
|
||||
}
|
||||
return rowID, nil
|
||||
}
|
||||
|
@ -253,7 +250,7 @@ func (s pgStorage) ObjectRowIDsForObjectIDs(ctx context.Context, objectIDs []str
|
|||
return nil, nil
|
||||
}
|
||||
query := fmt.Sprintf(`SELECT o.object_id, o.id FROM objects o WHERE o.object_id in (%s)`, strings.Join(common.DollarForEach(len(objectIDs)), ","))
|
||||
return s.keysToUUID(ctx, query, common.StringsToInterfaces(objectIDs)...)
|
||||
return s.keysToUUID(errors.WrapObjectQueryFailedError, ctx, query, common.StringsToInterfaces(objectIDs)...)
|
||||
}
|
||||
|
||||
func (s pgStorage) ObjectPayloadByUUID(ctx context.Context, objectIDs []uuid.UUID) (map[uuid.UUID]Payload, error) {
|
||||
|
@ -261,7 +258,7 @@ func (s pgStorage) ObjectPayloadByUUID(ctx context.Context, objectIDs []uuid.UUI
|
|||
return nil, nil
|
||||
}
|
||||
query := fmt.Sprintf(`SELECT o.id, o.payload FROM objects o WHERE o.id in (%s)`, strings.Join(common.DollarForEach(len(objectIDs)), ","))
|
||||
return s.uuidsToPayload(ctx, query, common.UUIDsToInterfaces(objectIDs)...)
|
||||
return s.uuidsToPayload(errors.WrapObjectQueryFailedError, ctx, query, common.UUIDsToInterfaces(objectIDs)...)
|
||||
}
|
||||
|
||||
func (s pgStorage) RecordObjectAnnouncement(ctx context.Context, actorID, activityID, objectID uuid.UUID) (uuid.UUID, error) {
|
||||
|
@ -274,7 +271,7 @@ func (s pgStorage) RecordObjectAnnouncementAll(ctx context.Context, rowID uuid.U
|
|||
query := `INSERT INTO object_boosts (id, created_at, updated_at, actor_id, activity_id, object_id) VALUES ($1, $2, $3, $4, $5, $6) RETURNING ID`
|
||||
var id uuid.UUID
|
||||
err := s.db.QueryRowContext(ctx, query, rowID, createdAt, updatedAt, actorID, activityID, objectID).Scan(&id)
|
||||
return id, errors.WrapInsertQueryFailedError(err)
|
||||
return id, errors.WrapObjectBoostInsertFailedError(err)
|
||||
}
|
||||
|
||||
func (s pgStorage) CountObjectBoostsByObjectIDs(ctx context.Context, objectIDs []uuid.UUID) ([]Count, error) {
|
||||
|
@ -283,7 +280,7 @@ func (s pgStorage) CountObjectBoostsByObjectIDs(ctx context.Context, objectIDs [
|
|||
}
|
||||
placeholders := common.DollarForEach(len(objectIDs))
|
||||
query := fmt.Sprintf(`SELECT object_id, COUNT(*) FROM object_boosts WHERE object_id IN (%s) GROUP BY object_id`, strings.Join(placeholders, ","))
|
||||
return s.keyedCount(ctx, query, common.UUIDsToInterfaces(objectIDs)...)
|
||||
return s.keyedCount(errors.WrapObjectBoostQueryFailedError, ctx, query, common.UUIDsToInterfaces(objectIDs)...)
|
||||
}
|
||||
|
||||
func (s pgStorage) CountObjectRepliesByObjectIDs(ctx context.Context, objectIDs []uuid.UUID) ([]Count, error) {
|
||||
|
@ -292,7 +289,7 @@ func (s pgStorage) CountObjectRepliesByObjectIDs(ctx context.Context, objectIDs
|
|||
}
|
||||
placeholders := common.DollarForEach(len(objectIDs))
|
||||
query := fmt.Sprintf(`SELECT parent_object_id, COUNT(*) FROM object_replies WHERE parent_object_id IN (%s) GROUP BY parent_object_id`, strings.Join(placeholders, ","))
|
||||
return s.keyedCount(ctx, query, common.UUIDsToInterfaces(objectIDs)...)
|
||||
return s.keyedCount(errors.WrapObjectReplyQueryFailedError, ctx, query, common.UUIDsToInterfaces(objectIDs)...)
|
||||
}
|
||||
|
||||
func (s pgStorage) CountObjectBoostsByActorObjectIDs(ctx context.Context, actorRowID uuid.UUID, objectRowIDs []uuid.UUID) ([]Count, error) {
|
||||
|
@ -301,7 +298,7 @@ func (s pgStorage) CountObjectBoostsByActorObjectIDs(ctx context.Context, actorR
|
|||
}
|
||||
placeholders := common.MapStrings(common.StringIntRange(2, len(objectRowIDs)+1), common.Dollar)
|
||||
query := fmt.Sprintf(`SELECT object_id, COUNT(*) FROM object_boosts WHERE actor_id = $1 AND object_id IN (%s) GROUP BY object_id`, strings.Join(placeholders, ","))
|
||||
return s.keyedCount(ctx, query, append([]interface{}{actorRowID}, common.UUIDsToInterfaces(objectRowIDs)...)...)
|
||||
return s.keyedCount(errors.WrapObjectBoostQueryFailedError, ctx, query, append([]interface{}{actorRowID}, common.UUIDsToInterfaces(objectRowIDs)...)...)
|
||||
}
|
||||
|
||||
func (s pgStorage) RecordObjectReply(ctx context.Context, objectID, parentObjectID uuid.UUID) (uuid.UUID, error) {
|
||||
|
@ -314,7 +311,7 @@ func (s pgStorage) RecordObjectReplyAll(ctx context.Context, rowID uuid.UUID, cr
|
|||
query := `INSERT INTO object_replies (id, created_at, updated_at, object_id, parent_object_id) VALUES ($1, $2, $3, $4, $5) ON CONFLICT ON CONSTRAINT object_replies_reply_uindex DO UPDATE SET updated_at = now() RETURNING id`
|
||||
var id uuid.UUID
|
||||
err := s.db.QueryRowContext(ctx, query, rowID, createdAt, updatedAt, objectID, parentObjectID).Scan(&id)
|
||||
return id, errors.WrapInsertQueryFailedError(err)
|
||||
return id, errors.WrapObjectReplyUpsertFailedError(err)
|
||||
}
|
||||
|
||||
func (s pgStorage) UpdateObjectPayload(ctx context.Context, objectRowID uuid.UUID, payload Payload) error {
|
||||
|
@ -336,7 +333,7 @@ func (s pgStorage) ObjectParentsByObjectID(ctx context.Context, objectRowID uuid
|
|||
)
|
||||
SELECT object_id, parent_object_id
|
||||
FROM object_parents`
|
||||
return s.toUUIDMultiMap(ctx, query, objectRowID)
|
||||
return s.toUUIDMultiMap(errors.WrapObjectReplySelectFailedError, ctx, query, objectRowID)
|
||||
}
|
||||
|
||||
func (s pgStorage) ObjectChildrenByObjectID(ctx context.Context, objectRowID uuid.UUID) (map[uuid.UUID][]uuid.UUID, error) {
|
||||
|
@ -352,29 +349,5 @@ func (s pgStorage) ObjectChildrenByObjectID(ctx context.Context, objectRowID uui
|
|||
)
|
||||
SELECT parent_object_id, object_id
|
||||
FROM object_children`
|
||||
return s.toUUIDMultiMap(ctx, query, objectRowID)
|
||||
}
|
||||
|
||||
func (s pgStorage) toUUIDMultiMap(ctx context.Context, query string, args ...interface{}) (map[uuid.UUID][]uuid.UUID, error) {
|
||||
results := make(map[uuid.UUID][]uuid.UUID)
|
||||
fmt.Println(query)
|
||||
fmt.Println(args...)
|
||||
rows, err := s.db.QueryContext(ctx, query, args...)
|
||||
if err != nil {
|
||||
return nil, errors.NewSelectQueryFailedError(err)
|
||||
}
|
||||
defer rows.Close()
|
||||
for rows.Next() {
|
||||
var key uuid.UUID
|
||||
var value uuid.UUID
|
||||
if err := rows.Scan(&key, &value); err != nil {
|
||||
return nil, errors.NewSelectQueryFailedError(err)
|
||||
}
|
||||
values, hasValues := results[key]
|
||||
if !hasValues {
|
||||
values = make([]uuid.UUID, 0)
|
||||
}
|
||||
results[key] = append(values, value)
|
||||
}
|
||||
return results, nil
|
||||
return s.toUUIDMultiMap(errors.WrapObjectReplySelectFailedError, ctx, query, objectRowID)
|
||||
}
|
||||
|
|
|
@ -18,11 +18,10 @@ type Storage interface {
|
|||
UserStorage
|
||||
ActorStorage
|
||||
FollowerStorage
|
||||
|
||||
PeerStorage
|
||||
ObjectStorage
|
||||
|
||||
AssetStorage
|
||||
InstanceStatsStorage
|
||||
|
||||
GetExecutor() QueryExecute
|
||||
GetLogger() *zap.Logger
|
||||
|
@ -121,84 +120,122 @@ func (s pgStorage) RowCount(ctx context.Context, query string, args ...interface
|
|||
}
|
||||
|
||||
func (s pgStorage) rowCount(qec QueryExecute, ctx context.Context, query string, args ...interface{}) (int, error) {
|
||||
return s.wrappedRowCount(errors.WrapQueryFailedError, qec, ctx, query, args...)
|
||||
}
|
||||
|
||||
func (s pgStorage) wrappedRowCount(ew errors.ErrorWrapper, qec QueryExecute, ctx context.Context, query string, args ...interface{}) (int, error) {
|
||||
s.logger.Debug("row count query", zap.String("query", query), zap.Reflect("args", args))
|
||||
|
||||
var total int
|
||||
|
||||
err := qec.QueryRowContext(ctx, query, args...).Scan(&total)
|
||||
if err != nil {
|
||||
return -1, err
|
||||
return -1, ew(err)
|
||||
}
|
||||
return total, nil
|
||||
}
|
||||
|
||||
func (s pgStorage) keyedCount(ctx context.Context, query string, args ...interface{}) ([]Count, error) {
|
||||
func (s pgStorage) wrappedExists(ew errors.ErrorWrapper, ctx context.Context, query string, args ...interface{}) (bool, error) {
|
||||
s.logger.Debug("row count query", zap.String("query", query), zap.Reflect("args", args))
|
||||
|
||||
var total int
|
||||
|
||||
err := s.db.QueryRowContext(ctx, query, args...).Scan(&total)
|
||||
if err != nil {
|
||||
return false, ew(err)
|
||||
}
|
||||
return total != 0, nil
|
||||
}
|
||||
|
||||
func (s pgStorage) keyedCount(ew errors.ErrorWrapper, ctx context.Context, query string, args ...interface{}) ([]Count, error) {
|
||||
results := make([]Count, 0)
|
||||
rows, err := s.db.QueryContext(ctx, query, args...)
|
||||
if err != nil {
|
||||
return nil, errors.NewSelectQueryFailedError(err)
|
||||
return nil, ew(err)
|
||||
}
|
||||
defer rows.Close()
|
||||
for rows.Next() {
|
||||
var count Count
|
||||
if err := rows.Scan(&count.Key, &count.Count); err != nil {
|
||||
return nil, errors.NewSelectQueryFailedError(err)
|
||||
return nil, ew(err)
|
||||
}
|
||||
results = append(results, count)
|
||||
}
|
||||
return results, nil
|
||||
}
|
||||
|
||||
func (s pgStorage) keysToUUID(ctx context.Context, query string, args ...interface{}) (map[string]uuid.UUID, error) {
|
||||
func (s pgStorage) keysToUUID(ew errors.ErrorWrapper, ctx context.Context, query string, args ...interface{}) (map[string]uuid.UUID, error) {
|
||||
results := make(map[string]uuid.UUID)
|
||||
rows, err := s.db.QueryContext(ctx, query, args...)
|
||||
if err != nil {
|
||||
return nil, errors.NewSelectQueryFailedError(err)
|
||||
return nil, ew(err)
|
||||
}
|
||||
defer rows.Close()
|
||||
for rows.Next() {
|
||||
var key string
|
||||
var id uuid.UUID
|
||||
if err := rows.Scan(&key, &id); err != nil {
|
||||
return nil, errors.NewSelectQueryFailedError(err)
|
||||
return nil, ew(err)
|
||||
}
|
||||
results[key] = id
|
||||
}
|
||||
return results, nil
|
||||
}
|
||||
|
||||
func (s pgStorage) uuidsToPayload(ctx context.Context, query string, args ...interface{}) (map[uuid.UUID]Payload, error) {
|
||||
func (s pgStorage) uuidsToPayload(ew errors.ErrorWrapper, ctx context.Context, query string, args ...interface{}) (map[uuid.UUID]Payload, error) {
|
||||
results := make(map[uuid.UUID]Payload)
|
||||
rows, err := s.db.QueryContext(ctx, query, args...)
|
||||
if err != nil {
|
||||
return nil, errors.NewSelectQueryFailedError(err)
|
||||
return nil, ew(err)
|
||||
}
|
||||
defer rows.Close()
|
||||
for rows.Next() {
|
||||
var key uuid.UUID
|
||||
var payload Payload
|
||||
if err := rows.Scan(&key, &payload); err != nil {
|
||||
return nil, errors.NewSelectQueryFailedError(err)
|
||||
return nil, ew(err)
|
||||
}
|
||||
results[key] = payload
|
||||
}
|
||||
return results, nil
|
||||
}
|
||||
|
||||
func (s pgStorage) uuidsToUuids(ctx context.Context, query string, args ...interface{}) (map[uuid.UUID]uuid.UUID, error) {
|
||||
func (s pgStorage) uuidsToUuids(ew errors.ErrorWrapper, ctx context.Context, query string, args ...interface{}) (map[uuid.UUID]uuid.UUID, error) {
|
||||
results := make(map[uuid.UUID]uuid.UUID)
|
||||
rows, err := s.db.QueryContext(ctx, query, args...)
|
||||
if err != nil {
|
||||
return nil, errors.NewSelectQueryFailedError(err)
|
||||
return nil, ew(err)
|
||||
}
|
||||
defer rows.Close()
|
||||
for rows.Next() {
|
||||
var key uuid.UUID
|
||||
var value uuid.UUID
|
||||
if err := rows.Scan(&key, &value); err != nil {
|
||||
return nil, errors.NewSelectQueryFailedError(err)
|
||||
return nil, ew(err)
|
||||
}
|
||||
results[key] = value
|
||||
}
|
||||
return results, nil
|
||||
}
|
||||
|
||||
func (s pgStorage) toUUIDMultiMap(ew errors.ErrorWrapper, ctx context.Context, query string, args ...interface{}) (map[uuid.UUID][]uuid.UUID, error) {
|
||||
results := make(map[uuid.UUID][]uuid.UUID)
|
||||
rows, err := s.db.QueryContext(ctx, query, args...)
|
||||
if err != nil {
|
||||
return nil, ew(err)
|
||||
}
|
||||
defer rows.Close()
|
||||
for rows.Next() {
|
||||
var key uuid.UUID
|
||||
var value uuid.UUID
|
||||
if err := rows.Scan(&key, &value); err != nil {
|
||||
return nil, ew(err)
|
||||
}
|
||||
values, hasValues := results[key]
|
||||
if !hasValues {
|
||||
values = make([]uuid.UUID, 0)
|
||||
}
|
||||
results[key] = append(values, value)
|
||||
}
|
||||
return results, nil
|
||||
}
|
||||
|
|
|
@ -487,161 +487,201 @@
|
|||
{
|
||||
"locale": "en",
|
||||
"key": "TAVDATAAAAAACX",
|
||||
"trans": "The object thread query failed."
|
||||
"trans": "The object tag query failed."
|
||||
},
|
||||
{
|
||||
"locale": "en",
|
||||
"key": "TAVDATAAAAAACY",
|
||||
"trans": "The select record operation for object thread failed."
|
||||
"trans": "The select record operation for object tag failed."
|
||||
},
|
||||
{
|
||||
"locale": "en",
|
||||
"key": "TAVDATAAAAAACZ",
|
||||
"trans": "The insert record operation for object thread failed."
|
||||
"trans": "The insert record operation for object tag failed."
|
||||
},
|
||||
{
|
||||
"locale": "en",
|
||||
"key": "TAVDATAAAAAAC0",
|
||||
"trans": "The upsert record operation for object thread failed."
|
||||
"trans": "The upsert record operation for object tag failed."
|
||||
},
|
||||
{
|
||||
"locale": "en",
|
||||
"key": "TAVDATAAAAAAC1",
|
||||
"trans": "The update record operation for object thread failed."
|
||||
"trans": "The update record operation for object tag failed."
|
||||
},
|
||||
{
|
||||
"locale": "en",
|
||||
"key": "TAVDATAAAAAAC2",
|
||||
"trans": "The delete record operation for object thread failed."
|
||||
"trans": "The delete record operation for object tag failed."
|
||||
},
|
||||
{
|
||||
"locale": "en",
|
||||
"key": "TAVDATAAAAAAC3",
|
||||
"trans": "The object thread is invalid."
|
||||
"trans": "The object tag is invalid."
|
||||
},
|
||||
{
|
||||
"locale": "en",
|
||||
"key": "TAVDATAAAAAAC4",
|
||||
"trans": "The object thread was not found."
|
||||
"trans": "The object tag was not found."
|
||||
},
|
||||
{
|
||||
"locale": "en",
|
||||
"key": "TAVDATAAAAAAC5",
|
||||
"trans": "The object boost query failed."
|
||||
"trans": "The object thread query failed."
|
||||
},
|
||||
{
|
||||
"locale": "en",
|
||||
"key": "TAVDATAAAAAAC6",
|
||||
"trans": "The select record operation for object boost failed."
|
||||
"trans": "The select record operation for object thread failed."
|
||||
},
|
||||
{
|
||||
"locale": "en",
|
||||
"key": "TAVDATAAAAAAC7",
|
||||
"trans": "The insert record operation for object boost failed."
|
||||
"trans": "The insert record operation for object thread failed."
|
||||
},
|
||||
{
|
||||
"locale": "en",
|
||||
"key": "TAVDATAAAAAAC8",
|
||||
"trans": "The upsert record operation for object boost failed."
|
||||
"trans": "The upsert record operation for object thread failed."
|
||||
},
|
||||
{
|
||||
"locale": "en",
|
||||
"key": "TAVDATAAAAAAC9",
|
||||
"trans": "The update record operation for object boost failed."
|
||||
"trans": "The update record operation for object thread failed."
|
||||
},
|
||||
{
|
||||
"locale": "en",
|
||||
"key": "TAVDATAAAAAADA",
|
||||
"trans": "The delete record operation for object boost failed."
|
||||
"trans": "The delete record operation for object thread failed."
|
||||
},
|
||||
{
|
||||
"locale": "en",
|
||||
"key": "TAVDATAAAAAADB",
|
||||
"trans": "The object boost is invalid."
|
||||
"trans": "The object thread is invalid."
|
||||
},
|
||||
{
|
||||
"locale": "en",
|
||||
"key": "TAVDATAAAAAADC",
|
||||
"trans": "The object boost was not found."
|
||||
"trans": "The object thread was not found."
|
||||
},
|
||||
{
|
||||
"locale": "en",
|
||||
"key": "TAVDATAAAAAADD",
|
||||
"trans": "The image query failed."
|
||||
"trans": "The object boost query failed."
|
||||
},
|
||||
{
|
||||
"locale": "en",
|
||||
"key": "TAVDATAAAAAADE",
|
||||
"trans": "The select record operation for image failed."
|
||||
"trans": "The select record operation for object boost failed."
|
||||
},
|
||||
{
|
||||
"locale": "en",
|
||||
"key": "TAVDATAAAAAADF",
|
||||
"trans": "The insert record operation for image failed."
|
||||
"trans": "The insert record operation for object boost failed."
|
||||
},
|
||||
{
|
||||
"locale": "en",
|
||||
"key": "TAVDATAAAAAADG",
|
||||
"trans": "The upsert record operation for image failed."
|
||||
"trans": "The upsert record operation for object boost failed."
|
||||
},
|
||||
{
|
||||
"locale": "en",
|
||||
"key": "TAVDATAAAAAADH",
|
||||
"trans": "The update record operation for image failed."
|
||||
"trans": "The update record operation for object boost failed."
|
||||
},
|
||||
{
|
||||
"locale": "en",
|
||||
"key": "TAVDATAAAAAADI",
|
||||
"trans": "The delete record operation for image failed."
|
||||
"trans": "The delete record operation for object boost failed."
|
||||
},
|
||||
{
|
||||
"locale": "en",
|
||||
"key": "TAVDATAAAAAADJ",
|
||||
"trans": "The image is invalid."
|
||||
"trans": "The object boost is invalid."
|
||||
},
|
||||
{
|
||||
"locale": "en",
|
||||
"key": "TAVDATAAAAAADK",
|
||||
"trans": "The image was not found."
|
||||
"trans": "The object boost was not found."
|
||||
},
|
||||
{
|
||||
"locale": "en",
|
||||
"key": "TAVDATAAAAAADL",
|
||||
"trans": "The image alias query failed."
|
||||
"trans": "The image query failed."
|
||||
},
|
||||
{
|
||||
"locale": "en",
|
||||
"key": "TAVDATAAAAAADM",
|
||||
"trans": "The select record operation for image alias failed."
|
||||
"trans": "The select record operation for image failed."
|
||||
},
|
||||
{
|
||||
"locale": "en",
|
||||
"key": "TAVDATAAAAAADN",
|
||||
"trans": "The insert record operation for image alias failed."
|
||||
"trans": "The insert record operation for image failed."
|
||||
},
|
||||
{
|
||||
"locale": "en",
|
||||
"key": "TAVDATAAAAAADO",
|
||||
"trans": "The upsert record operation for image alias failed."
|
||||
"trans": "The upsert record operation for image failed."
|
||||
},
|
||||
{
|
||||
"locale": "en",
|
||||
"key": "TAVDATAAAAAADP",
|
||||
"trans": "The update record operation for image alias failed."
|
||||
"trans": "The update record operation for image failed."
|
||||
},
|
||||
{
|
||||
"locale": "en",
|
||||
"key": "TAVDATAAAAAADQ",
|
||||
"trans": "The delete record operation for image alias failed."
|
||||
"trans": "The delete record operation for image failed."
|
||||
},
|
||||
{
|
||||
"locale": "en",
|
||||
"key": "TAVDATAAAAAADR",
|
||||
"trans": "The image alias is invalid."
|
||||
"trans": "The image is invalid."
|
||||
},
|
||||
{
|
||||
"locale": "en",
|
||||
"key": "TAVDATAAAAAADS",
|
||||
"trans": "The image was not found."
|
||||
},
|
||||
{
|
||||
"locale": "en",
|
||||
"key": "TAVDATAAAAAADT",
|
||||
"trans": "The image alias query failed."
|
||||
},
|
||||
{
|
||||
"locale": "en",
|
||||
"key": "TAVDATAAAAAADU",
|
||||
"trans": "The select record operation for image alias failed."
|
||||
},
|
||||
{
|
||||
"locale": "en",
|
||||
"key": "TAVDATAAAAAADV",
|
||||
"trans": "The insert record operation for image alias failed."
|
||||
},
|
||||
{
|
||||
"locale": "en",
|
||||
"key": "TAVDATAAAAAADW",
|
||||
"trans": "The upsert record operation for image alias failed."
|
||||
},
|
||||
{
|
||||
"locale": "en",
|
||||
"key": "TAVDATAAAAAADX",
|
||||
"trans": "The update record operation for image alias failed."
|
||||
},
|
||||
{
|
||||
"locale": "en",
|
||||
"key": "TAVDATAAAAAADY",
|
||||
"trans": "The delete record operation for image alias failed."
|
||||
},
|
||||
{
|
||||
"locale": "en",
|
||||
"key": "TAVDATAAAAAADZ",
|
||||
"trans": "The image alias is invalid."
|
||||
},
|
||||
{
|
||||
"locale": "en",
|
||||
"key": "TAVDATAAAAAAD0",
|
||||
"trans": "The image alias was not found."
|
||||
},
|
||||
{
|
||||
|
|
|
@ -11,32 +11,33 @@ import (
|
|||
)
|
||||
|
||||
func (h handler) apiV1Instance(c *gin.Context) {
|
||||
user, err := h.storage.GetUserByName(c.Request.Context(), h.adminUser)
|
||||
ctx := c.Request.Context()
|
||||
user, err := h.storage.GetUserByName(ctx, h.adminUser)
|
||||
if err != nil {
|
||||
h.internalServerErrorJSON(c, err)
|
||||
return
|
||||
}
|
||||
followers, err := h.storage.RowCount(c.Request.Context(), `SELECT COUNT(*) FROM network_graph WHERE user_id = $1`, user.ID)
|
||||
followers, err := h.storage.CountUserFollowers(ctx, user.ID)
|
||||
if err != nil {
|
||||
h.internalServerErrorJSON(c, err)
|
||||
return
|
||||
}
|
||||
following, err := h.storage.RowCount(c.Request.Context(), `SELECT COUNT(*) FROM network_graph WHERE user_id = $1`, user.ID)
|
||||
following, err := h.storage.CountUserFollowing(ctx, user.ID)
|
||||
if err != nil {
|
||||
h.internalServerErrorJSON(c, err)
|
||||
return
|
||||
}
|
||||
users, err := h.storage.RowCount(c.Request.Context(), `SELECT COUNT(*) FROM users`)
|
||||
users, err := h.storage.CountUsers(ctx)
|
||||
if err != nil {
|
||||
h.internalServerErrorJSON(c, err)
|
||||
return
|
||||
}
|
||||
activities, err := h.storage.RowCount(c.Request.Context(), `SELECT COUNT(*) FROM user_object_events`)
|
||||
activities, err := h.storage.CountObjectEvents(ctx)
|
||||
if err != nil {
|
||||
h.internalServerErrorJSON(c, err)
|
||||
return
|
||||
}
|
||||
userActivities, err := h.storage.RowCount(c.Request.Context(), `SELECT COUNT(*) FROM user_object_events WHERE user_id = $1`, user.ID)
|
||||
userActivities, err := h.storage.CountUserObjectEvents(ctx, user.ID)
|
||||
if err != nil {
|
||||
h.internalServerErrorJSON(c, err)
|
||||
return
|
||||
|
|
|
@ -62,11 +62,11 @@ func (h handler) avatar(c *gin.Context) ([]byte, error) {
|
|||
return []byte(svg), nil
|
||||
}
|
||||
|
||||
exists, err := h.storage.RowCount(c.Request.Context(), `SELECT COUNT(*) FROM actor_aliases WHERE alias = $1 AND alias_type = 0`, fmt.Sprintf("acct:%s@%s", name, domain))
|
||||
exists, err := h.storage.ActorAliasSubjectExists(c.Request.Context(), fmt.Sprintf("acct:%s@%s", name, domain))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if exists == 0 {
|
||||
if !exists {
|
||||
svg := avatar.AvatarSVG("unknown", size, false)
|
||||
return []byte(svg), nil
|
||||
}
|
||||
|
|
|
@ -764,7 +764,7 @@ func (h handler) deleteNote(c *gin.Context) {
|
|||
return
|
||||
}
|
||||
|
||||
followerTotal, err := h.storage.RowCount(ctx, `SELECT COUNT(*) FROM network_graph WHERE user_id = $1`, user.ID)
|
||||
followerTotal, err := h.storage.CountFollowers(ctx, user.ID)
|
||||
if err != nil {
|
||||
h.internalServerErrorJSON(c, err)
|
||||
return
|
||||
|
|
|
@ -50,7 +50,7 @@ func (h handler) dashboardNetwork(c *gin.Context) {
|
|||
var pendingFollowers []string
|
||||
|
||||
err = storage.TransactionalStorage(ctx, h.storage, func(txStorage storage.Storage) error {
|
||||
totalFollowers, err = txStorage.RowCount(ctx, `SELECT COUNT(*) FROM network_graph WHERE user_id = $1`, user.ID)
|
||||
totalFollowers, err = txStorage.CountFollowers(ctx, user.ID)
|
||||
followers, err = txStorage.ListAcceptedFollowers(ctx, user.ID, totalFollowers+1, 0)
|
||||
if err != nil {
|
||||
return err
|
||||
|
@ -69,7 +69,7 @@ func (h handler) dashboardNetwork(c *gin.Context) {
|
|||
data["followers"] = followers
|
||||
data["pending_followers"] = pendingFollowers
|
||||
|
||||
totalFollowing, err := h.storage.RowCount(ctx, `SELECT COUNT(*) FROM network_graph WHERE user_id = $1`, user.ID)
|
||||
totalFollowing, err := h.storage.CountFollowing(ctx, user.ID)
|
||||
if err != nil {
|
||||
h.hardFail(c, err)
|
||||
return
|
||||
|
|
|
@ -25,23 +25,23 @@ func (h handler) nodeInfo(c *gin.Context) {
|
|||
}
|
||||
|
||||
func (h handler) nodeInfoDetails(c *gin.Context) {
|
||||
users, err := h.storage.RowCount(c.Request.Context(), `SELECT COUNT(*) FROM users`)
|
||||
users, err := h.storage.CountUsers(c.Request.Context())
|
||||
if err != nil {
|
||||
h.internalServerErrorJSON(c, err)
|
||||
return
|
||||
}
|
||||
users30Days, err := h.storage.RowCount(c.Request.Context(), `SELECT COUNT(*) FROM users WHERE last_auth_at > NOW() - INTERVAL '31 days'`)
|
||||
users30Days, err := h.storage.CountUsersLastMonth(c.Request.Context())
|
||||
if err != nil {
|
||||
h.internalServerErrorJSON(c, err)
|
||||
return
|
||||
}
|
||||
users183Days, err := h.storage.RowCount(c.Request.Context(), `SELECT COUNT(*) FROM users WHERE last_auth_at > NOW() - INTERVAL '183 days'`)
|
||||
users183Days, err := h.storage.CountUsersLastHalfYear(c.Request.Context())
|
||||
if err != nil {
|
||||
h.internalServerErrorJSON(c, err)
|
||||
return
|
||||
}
|
||||
|
||||
activities, err := h.storage.RowCount(c.Request.Context(), `SELECT COUNT(*) FROM user_object_events`)
|
||||
activities, err := h.storage.CountObjectEvents(c.Request.Context())
|
||||
if err != nil {
|
||||
h.internalServerErrorJSON(c, err)
|
||||
return
|
||||
|
|
Loading…
Reference in New Issue