MCPcopy Create free account
hub / github.com/fnproject/fn / buildFilterAppQuery

Function buildFilterAppQuery

api/datastore/sql/sql.go:705–728  ·  view source on GitHub ↗
(filter *models.AppFilter)

Source from the content-addressed store, hash-verified

703}
704
705func buildFilterAppQuery(filter *models.AppFilter) (string, []interface{}, error) {
706 var args []interface{}
707 if filter == nil {
708 return "", args, nil
709 }
710
711 var b bytes.Buffer
712
713 if filter.Cursor != "" {
714 s, err := base64.RawURLEncoding.DecodeString(filter.Cursor)
715 if err != nil {
716 return "", args, err
717 }
718 args = where(&b, args, "name>?", string(s))
719 }
720 if filter.Name != "" {
721 args = where(&b, args, "name=?", filter.Name)
722 }
723
724 fmt.Fprintf(&b, ` ORDER BY name ASC`) // TODO assert this is indexed
725 fmt.Fprintf(&b, ` LIMIT ?`)
726 args = append(args, filter.PerPage)
727 return b.String(), args, nil
728}
729
730func buildFilterFnQuery(filter *models.FnFilter) (string, []interface{}, error) {
731 if filter == nil {

Callers 1

GetAppsMethod · 0.85

Calls 2

whereFunction · 0.85
StringMethod · 0.45

Tested by

no test coverage detected