@@ -22,7 +22,7 @@ type Article struct {
2222 Tags []string `db:"tags"`
2323}
2424
25- func (qry * Query ) ListArticles (limit , offset int ) ([]Article , error ) {
25+ func (qry * Query ) ListRecentArticles (limit , offset int ) ([]Article , error ) {
2626 stmt := `
2727 WITH latest AS (
2828 SELECT
@@ -64,7 +64,7 @@ func (qry *Query) ListArticles(limit, offset int) ([]Article, error) {
6464 return articles , nil
6565}
6666
67- func (f * Query ) ListArticlesByAccount (account * model.Account , limit , offset int ) ([]Article , error ) {
67+ func (qry * Query ) ListRecentArticlesByAccount (account * model.Account , limit , offset int ) ([]Article , error ) {
6868 stmt := `
6969 WITH latest AS (
7070 SELECT
@@ -98,7 +98,7 @@ func (f *Query) ListArticlesByAccount(account *model.Account, limit, offset int)
9898 ctx , cancel := context .WithTimeout (context .Background (), postgres .Timeout )
9999 defer cancel ()
100100
101- rows , err := f .conn .Query (ctx , stmt , account .ID (), limit , offset )
101+ rows , err := qry .conn .Query (ctx , stmt , account .ID (), limit , offset )
102102 if err != nil {
103103 return nil , err
104104 }
@@ -111,7 +111,7 @@ func (f *Query) ListArticlesByAccount(account *model.Account, limit, offset int)
111111 return articles , nil
112112}
113113
114- func (f * Query ) SearchArticles (search string , limit , offset int ) ([]Article , error ) {
114+ func (qry * Query ) ListRelevantArticles (search string , limit , offset int ) ([]Article , error ) {
115115 stmt := `
116116 WITH relevant AS (
117117 SELECT
@@ -141,7 +141,7 @@ func (f *Query) SearchArticles(search string, limit, offset int) ([]Article, err
141141 ctx , cancel := context .WithTimeout (context .Background (), postgres .Timeout )
142142 defer cancel ()
143143
144- rows , err := f .conn .Query (ctx , stmt , search , limit , offset )
144+ rows , err := qry .conn .Query (ctx , stmt , search , limit , offset )
145145 if err != nil {
146146 return nil , err
147147 }
@@ -154,7 +154,7 @@ func (f *Query) SearchArticles(search string, limit, offset int) ([]Article, err
154154 return articles , nil
155155}
156156
157- func (f * Query ) SearchArticlesByAccount (account * model.Account , search string , limit , offset int ) ([]Article , error ) {
157+ func (qry * Query ) ListRelevantArticlesByAccount (account * model.Account , search string , limit , offset int ) ([]Article , error ) {
158158 stmt := `
159159 WITH relevant AS (
160160 SELECT
@@ -189,7 +189,7 @@ func (f *Query) SearchArticlesByAccount(account *model.Account, search string, l
189189 ctx , cancel := context .WithTimeout (context .Background (), postgres .Timeout )
190190 defer cancel ()
191191
192- rows , err := f .conn .Query (ctx , stmt , account .ID (), search , limit , offset )
192+ rows , err := qry .conn .Query (ctx , stmt , account .ID (), search , limit , offset )
193193 if err != nil {
194194 return nil , err
195195 }
@@ -202,15 +202,15 @@ func (f *Query) SearchArticlesByAccount(account *model.Account, search string, l
202202 return articles , nil
203203}
204204
205- func (f * Query ) CountArticles () (int , error ) {
205+ func (qry * Query ) CountRecentArticles () (int , error ) {
206206 stmt := `
207207 SELECT count(*)
208208 FROM post`
209209
210210 ctx , cancel := context .WithTimeout (context .Background (), postgres .Timeout )
211211 defer cancel ()
212212
213- rows , err := f .conn .Query (ctx , stmt )
213+ rows , err := qry .conn .Query (ctx , stmt )
214214 if err != nil {
215215 return 0 , err
216216 }
@@ -223,7 +223,7 @@ func (f *Query) CountArticles() (int, error) {
223223 return count , nil
224224}
225225
226- func (f * Query ) CountArticlesByAccount (account * model.Account ) (int , error ) {
226+ func (qry * Query ) CountRecentArticlesByAccount (account * model.Account ) (int , error ) {
227227 stmt := `
228228 SELECT count(*)
229229 FROM post
@@ -236,7 +236,7 @@ func (f *Query) CountArticlesByAccount(account *model.Account) (int, error) {
236236 ctx , cancel := context .WithTimeout (context .Background (), postgres .Timeout )
237237 defer cancel ()
238238
239- rows , err := f .conn .Query (ctx , stmt , account .ID ())
239+ rows , err := qry .conn .Query (ctx , stmt , account .ID ())
240240 if err != nil {
241241 return 0 , err
242242 }
@@ -249,7 +249,7 @@ func (f *Query) CountArticlesByAccount(account *model.Account) (int, error) {
249249 return count , nil
250250}
251251
252- func (f * Query ) CountSearchArticles (search string ) (int , error ) {
252+ func (qry * Query ) CountRelevantArticles (search string ) (int , error ) {
253253 stmt := `
254254 SELECT count(*)
255255 FROM post
@@ -258,7 +258,7 @@ func (f *Query) CountSearchArticles(search string) (int, error) {
258258 ctx , cancel := context .WithTimeout (context .Background (), postgres .Timeout )
259259 defer cancel ()
260260
261- rows , err := f .conn .Query (ctx , stmt , search )
261+ rows , err := qry .conn .Query (ctx , stmt , search )
262262 if err != nil {
263263 return 0 , err
264264 }
@@ -271,7 +271,7 @@ func (f *Query) CountSearchArticles(search string) (int, error) {
271271 return count , nil
272272}
273273
274- func (f * Query ) CountSearchArticlesByAccount (account * model.Account , search string ) (int , error ) {
274+ func (qry * Query ) CountRelevantArticlesByAccount (account * model.Account , search string ) (int , error ) {
275275 stmt := `
276276 SELECT count(*)
277277 FROM post
@@ -285,7 +285,7 @@ func (f *Query) CountSearchArticlesByAccount(account *model.Account, search stri
285285 ctx , cancel := context .WithTimeout (context .Background (), postgres .Timeout )
286286 defer cancel ()
287287
288- rows , err := f .conn .Query (ctx , stmt , account .ID (), search )
288+ rows , err := qry .conn .Query (ctx , stmt , account .ID (), search )
289289 if err != nil {
290290 return 0 , err
291291 }
0 commit comments