Monorepo for Tangled tangled.org

appview: db: follow: add GetFollowers and GetFollowing functions to fetch Follows #483

merged opened by ptr.pet targeting master from [deleted fork]: followers-following-list
Labels

None yet.

assignee

None yet.

Participants 2
AT URI
at://did:plc:dfl62fgb7wtjj3fcbb72naae/sh.tangled.repo.pull/3lwawsuk3dd22
+6 -3
Interdiff #1 #2
+6 -3
appview/db/follow.go
··· 84 84 } 85 85 limitClause := "" 86 86 if limit > 0 { 87 - limitClause = fmt.Sprintf(" limit %d", limit) 87 + limitClause = " limit ?" 88 + args = append(args, limit) 88 89 } 89 90 90 - rows, err := e.Query(` 91 - select user_did, subject_did, followed_at, rkey 91 + query := fmt.Sprintf( 92 + `select user_did, subject_did, followed_at, rkey 92 93 from follows 93 94 %s 94 95 order by followed_at desc 95 96 %s 96 97 `, whereClause, limitClause) 98 + 99 + rows, err := e.Query(query, args...) 97 100 if err != nil { 98 101 return nil, err 99 102 }
appview/db/timeline.go

This file has not been changed.

History

3 rounds 3 comments
sign up or login to add to the discussion
1 commit
expand
1934494f
appview: db: follow: add GetFollowers and GetFollowing functions to fetch Follows
expand 1 comment

oops T.T actually fixed it

pull request successfully merged
1 commit
expand
876e3d98
appview: db: follow: add GetFollowers and GetFollowing functions to fetch Follows
expand 1 comment

made a GetFollows, and made the GetFollowers and GetFollowing use that (and also removed GetAllFollows since its not necessary with GetFollows)

ptr.pet submitted #0
1 commit
expand
b6358b5b
appview: db: follow: add GetFollowers and GetFollowing functions to fetch Follows
expand 1 comment

this is pretty cool! couple of points:

  • the GetFollow* methods are a bit repetitive (in part due to the database/sql APIs), can we dedup them like we do in the rest of the codebase? the approach we use here is to write GetItem(e Execer, filters ...filter) ([]Item, error) and then use filters to create more specific getters. you can look at db/spindles for an example
  • we could do something similar for GetFollowStatus i think