49 lines
1.1 KiB
Go
49 lines
1.1 KiB
Go
package portfolio
|
|
|
|
// import (
|
|
// "crussell/db"
|
|
// "net/http"
|
|
// )
|
|
|
|
// func GetImages(w http.ResponseWriter, r *http.Request) {
|
|
// rows, err := db.DB.Query(r.Context(), `
|
|
// select id, r2_url
|
|
// from images
|
|
// where
|
|
// ($1::text[] is null or tag_names @> $1)
|
|
// and ($2::text is null or exists (
|
|
// select 1 from unnest(tag_names) as tag
|
|
// where tag ilike '%' || $2 || '%'
|
|
// ))
|
|
// order by created_at desc
|
|
// limit $3 offset $4
|
|
// `,
|
|
// semanticTags,
|
|
// searchTerm,
|
|
// limit,
|
|
// offset,
|
|
// )
|
|
// }
|
|
|
|
// func getAutoCompleteAdmin(w http.ResponseWriter, r *http.Request) {
|
|
// rows, err := db.DB.Query(r.Context(), `
|
|
// select name
|
|
// from tags
|
|
// where name ilike '%' || $1 || '%'
|
|
// order by similarity(name, $1) desc
|
|
// limit 10
|
|
// `, query)
|
|
// }
|
|
|
|
// func getAutoCompleteUser(w http.ResponseWriter, r *http.Request) {
|
|
// rows, err := db.DB.Query(r.Context(), `
|
|
// select name
|
|
// from tags
|
|
// where
|
|
// name not like '%:%'
|
|
// and name ilike '%' || $1 || '%'
|
|
// order by similarity(name, $1) desc
|
|
// limit 10
|
|
// `, query)
|
|
// }
|