MCPcopy Index your code
hub / github.com/tinode/chat / expandQuery

Function expandQuery

server/db/postgres/adapter.go:3653–3662  ·  view source on GitHub ↗

expandQuery replaces the placeholders in the query with the actual values and returns the expanded query and the arguments to be used in the query.

(query string, args ...any)

Source from the content-addressed store, hash-verified

3651// expandQuery replaces the placeholders in the query with the actual values and returns
3652// the expanded query and the arguments to be used in the query.
3653func expandQuery(query string, args ...any) (string, []any) {
3654 var expandedArgs []any
3655 var expandedQuery string
3656
3657 if len(args) != strings.Count(query, "?") {
3658 args = flattenSlice(args)
3659 }
3660 expandedQuery, expandedArgs, _ = sqlx.In(query, args...)
3661 return sqlx.Rebind(sqlx.DOLLAR, expandedQuery), expandedArgs
3662}
3663
3664// flatMap converts a slice of mixed values/slices into a flat slice.
3665func flattenSlice(slice []any) []any {

Callers 15

removeTagsFunction · 0.85
AuthUpdRecordMethod · 0.85
UserUpdateMethod · 0.85
UserUnreadCountMethod · 0.85
TopicsForUserMethod · 0.85
UsersForTopicMethod · 0.85
TopicDeleteMethod · 0.85
TopicUpdateMethod · 0.85
SubsForTopicMethod · 0.85
SubsUpdateMethod · 0.85
FindOneMethod · 0.85
MessageGetAllMethod · 0.85

Calls 1

flattenSliceFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…