Skip to content

Commit

Permalink
documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel-burghardt committed Jun 26, 2024
1 parent b3aac4f commit a98f621
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions internal/data/query_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ func (o SortOrder) IsValid() bool {
return o == ASC || o == DESC
}

// PrepareNamedQuery prepares the given query replacing the named parameters with Postgres' bindvars.
// It returns an SQL Injection-safe query and the arguments array to be used alongside it.
func PrepareNamedQuery(ctx context.Context, connectionPool db.ConnectionPool, namedQuery string, argsMap map[string]interface{}) (string, []interface{}, error) {
query, args, err := sqlx.Named(namedQuery, argsMap)
if err != nil {
Expand Down

0 comments on commit a98f621

Please sign in to comment.