snapshot of https://github.com/sqlc-dev/sqlc.git (main, 2026-09-16; blobs > 131072B omitted)
Some checks failed
kotlin / test (push) Has been skipped
python / test (push) Has been skipped
typescript / test (push) Has been skipped
go / build darwin/amd64 (push) Has been cancelled
go / build linux/amd64 (push) Has been cancelled
go / build windows/amd64 (push) Has been cancelled
go / build darwin/arm64 (push) Has been cancelled
go / build linux/arm64 (push) Has been cancelled
go / build windows/arm64 (push) Has been cancelled
go / test (push) Has been cancelled
go / vuln_check (push) Has been cancelled

This commit is contained in:
upstream-mirror
2026-09-16 02:17:34 +05:00
commit 0f4df23290
7340 changed files with 238743 additions and 0 deletions

View File

@@ -0,0 +1,165 @@
// Code generated by sqlc. DO NOT EDIT.
// versions:
// sqlc v1.31.1
// source: aggfunc.sql
package querytest
import (
"context"
"database/sql"
)
const getAvg = `-- name: GetAvg :one
SELECT avg(int_val) FROM test
`
func (q *Queries) GetAvg(ctx context.Context) (sql.NullFloat64, error) {
row := q.db.QueryRowContext(ctx, getAvg)
var avg sql.NullFloat64
err := row.Scan(&avg)
return avg, err
}
const getCount = `-- name: GetCount :one
SELECT count(*) FROM test
`
func (q *Queries) GetCount(ctx context.Context) (int64, error) {
row := q.db.QueryRowContext(ctx, getCount)
var count int64
err := row.Scan(&count)
return count, err
}
const getCountId = `-- name: GetCountId :one
SELECT count(id) FROM test
`
func (q *Queries) GetCountId(ctx context.Context) (int64, error) {
row := q.db.QueryRowContext(ctx, getCountId)
var count int64
err := row.Scan(&count)
return count, err
}
const getGroupConcatInt = `-- name: GetGroupConcatInt :one
SELECT group_concat(int_val) FROM test
`
func (q *Queries) GetGroupConcatInt(ctx context.Context) (sql.NullString, error) {
row := q.db.QueryRowContext(ctx, getGroupConcatInt)
var group_concat sql.NullString
err := row.Scan(&group_concat)
return group_concat, err
}
const getGroupConcatInt2 = `-- name: GetGroupConcatInt2 :one
SELECT group_concat(1, ':') FROM test
`
func (q *Queries) GetGroupConcatInt2(ctx context.Context) (sql.NullString, error) {
row := q.db.QueryRowContext(ctx, getGroupConcatInt2)
var group_concat sql.NullString
err := row.Scan(&group_concat)
return group_concat, err
}
const getGroupConcatText = `-- name: GetGroupConcatText :one
SELECT group_concat(text_val) FROM test
`
func (q *Queries) GetGroupConcatText(ctx context.Context) (sql.NullString, error) {
row := q.db.QueryRowContext(ctx, getGroupConcatText)
var group_concat sql.NullString
err := row.Scan(&group_concat)
return group_concat, err
}
const getGroupConcatText2 = `-- name: GetGroupConcatText2 :one
SELECT group_concat(text_val, ':') FROM test
`
func (q *Queries) GetGroupConcatText2(ctx context.Context) (sql.NullString, error) {
row := q.db.QueryRowContext(ctx, getGroupConcatText2)
var group_concat sql.NullString
err := row.Scan(&group_concat)
return group_concat, err
}
const getMaxInt = `-- name: GetMaxInt :one
SELECT max(int_val) FROM test
`
func (q *Queries) GetMaxInt(ctx context.Context) (any, error) {
row := q.db.QueryRowContext(ctx, getMaxInt)
var max any
err := row.Scan(&max)
return max, err
}
const getMaxText = `-- name: GetMaxText :one
SELECT max(text_val) FROM test
`
func (q *Queries) GetMaxText(ctx context.Context) (any, error) {
row := q.db.QueryRowContext(ctx, getMaxText)
var max any
err := row.Scan(&max)
return max, err
}
const getMinInt = `-- name: GetMinInt :one
SELECT min(int_val) FROM test
`
func (q *Queries) GetMinInt(ctx context.Context) (any, error) {
row := q.db.QueryRowContext(ctx, getMinInt)
var min any
err := row.Scan(&min)
return min, err
}
const getMinText = `-- name: GetMinText :one
SELECT min(text_val) FROM test
`
func (q *Queries) GetMinText(ctx context.Context) (any, error) {
row := q.db.QueryRowContext(ctx, getMinText)
var min any
err := row.Scan(&min)
return min, err
}
const getSumInt = `-- name: GetSumInt :one
SELECT sum(int_val) FROM test
`
func (q *Queries) GetSumInt(ctx context.Context) (sql.NullFloat64, error) {
row := q.db.QueryRowContext(ctx, getSumInt)
var sum sql.NullFloat64
err := row.Scan(&sum)
return sum, err
}
const getSumText = `-- name: GetSumText :one
SELECT sum(text_val) FROM test
`
func (q *Queries) GetSumText(ctx context.Context) (sql.NullFloat64, error) {
row := q.db.QueryRowContext(ctx, getSumText)
var sum sql.NullFloat64
err := row.Scan(&sum)
return sum, err
}
const getTotalInt = `-- name: GetTotalInt :one
SELECT total(int_val) FROM test
`
func (q *Queries) GetTotalInt(ctx context.Context) (float64, error) {
row := q.db.QueryRowContext(ctx, getTotalInt)
var total float64
err := row.Scan(&total)
return total, err
}

View File

@@ -0,0 +1,31 @@
// Code generated by sqlc. DO NOT EDIT.
// versions:
// sqlc v1.31.1
package querytest
import (
"context"
"database/sql"
)
type DBTX interface {
ExecContext(context.Context, string, ...any) (sql.Result, error)
PrepareContext(context.Context, string) (*sql.Stmt, error)
QueryContext(context.Context, string, ...any) (*sql.Rows, error)
QueryRowContext(context.Context, string, ...any) *sql.Row
}
func New(db DBTX) *Queries {
return &Queries{db: db}
}
type Queries struct {
db DBTX
}
func (q *Queries) WithTx(tx *sql.Tx) *Queries {
return &Queries{
db: tx,
}
}

View File

@@ -0,0 +1,329 @@
// Code generated by sqlc. DO NOT EDIT.
// versions:
// sqlc v1.31.1
// source: mathfunc.sql
package querytest
import (
"context"
)
const getAcos = `-- name: GetAcos :one
SELECT acos(1.0)
`
func (q *Queries) GetAcos(ctx context.Context) (float64, error) {
row := q.db.QueryRowContext(ctx, getAcos)
var acos float64
err := row.Scan(&acos)
return acos, err
}
const getAcosh = `-- name: GetAcosh :one
SELECT acosh(1.0)
`
func (q *Queries) GetAcosh(ctx context.Context) (float64, error) {
row := q.db.QueryRowContext(ctx, getAcosh)
var acosh float64
err := row.Scan(&acosh)
return acosh, err
}
const getAsin = `-- name: GetAsin :one
SELECT asin(1.0)
`
func (q *Queries) GetAsin(ctx context.Context) (float64, error) {
row := q.db.QueryRowContext(ctx, getAsin)
var asin float64
err := row.Scan(&asin)
return asin, err
}
const getAsinh = `-- name: GetAsinh :one
SELECT asinh(1.0)
`
func (q *Queries) GetAsinh(ctx context.Context) (float64, error) {
row := q.db.QueryRowContext(ctx, getAsinh)
var asinh float64
err := row.Scan(&asinh)
return asinh, err
}
const getAtan = `-- name: GetAtan :one
SELECT atan(1.0)
`
func (q *Queries) GetAtan(ctx context.Context) (float64, error) {
row := q.db.QueryRowContext(ctx, getAtan)
var atan float64
err := row.Scan(&atan)
return atan, err
}
const getAtan2 = `-- name: GetAtan2 :one
SELECT atan2(1.0, 0.5)
`
func (q *Queries) GetAtan2(ctx context.Context) (float64, error) {
row := q.db.QueryRowContext(ctx, getAtan2)
var atan2 float64
err := row.Scan(&atan2)
return atan2, err
}
const getAtanh = `-- name: GetAtanh :one
SELECT atanh(1.0)
`
func (q *Queries) GetAtanh(ctx context.Context) (float64, error) {
row := q.db.QueryRowContext(ctx, getAtanh)
var atanh float64
err := row.Scan(&atanh)
return atanh, err
}
const getCeil = `-- name: GetCeil :one
SELECT ceil(1.0)
`
func (q *Queries) GetCeil(ctx context.Context) (float64, error) {
row := q.db.QueryRowContext(ctx, getCeil)
var ceil float64
err := row.Scan(&ceil)
return ceil, err
}
const getCeilin = `-- name: GetCeilin :one
SELECT ceiling(1.0)
`
func (q *Queries) GetCeilin(ctx context.Context) (float64, error) {
row := q.db.QueryRowContext(ctx, getCeilin)
var ceiling float64
err := row.Scan(&ceiling)
return ceiling, err
}
const getCos = `-- name: GetCos :one
SELECT cos(1.0)
`
func (q *Queries) GetCos(ctx context.Context) (float64, error) {
row := q.db.QueryRowContext(ctx, getCos)
var cos float64
err := row.Scan(&cos)
return cos, err
}
const getCosh = `-- name: GetCosh :one
SELECT cosh(1.0)
`
func (q *Queries) GetCosh(ctx context.Context) (float64, error) {
row := q.db.QueryRowContext(ctx, getCosh)
var cosh float64
err := row.Scan(&cosh)
return cosh, err
}
const getDegrees = `-- name: GetDegrees :one
SELECT degrees(1.0)
`
func (q *Queries) GetDegrees(ctx context.Context) (float64, error) {
row := q.db.QueryRowContext(ctx, getDegrees)
var degrees float64
err := row.Scan(&degrees)
return degrees, err
}
const getExp = `-- name: GetExp :one
SELECT exp(1.0)
`
func (q *Queries) GetExp(ctx context.Context) (float64, error) {
row := q.db.QueryRowContext(ctx, getExp)
var exp float64
err := row.Scan(&exp)
return exp, err
}
const getFloor = `-- name: GetFloor :one
SELECT floor(1.0)
`
func (q *Queries) GetFloor(ctx context.Context) (float64, error) {
row := q.db.QueryRowContext(ctx, getFloor)
var floor float64
err := row.Scan(&floor)
return floor, err
}
const getLn = `-- name: GetLn :one
SELECT ln(1.0)
`
func (q *Queries) GetLn(ctx context.Context) (float64, error) {
row := q.db.QueryRowContext(ctx, getLn)
var ln float64
err := row.Scan(&ln)
return ln, err
}
const getLog = `-- name: GetLog :one
SELECT log(1.0)
`
func (q *Queries) GetLog(ctx context.Context) (float64, error) {
row := q.db.QueryRowContext(ctx, getLog)
var log float64
err := row.Scan(&log)
return log, err
}
const getLog10 = `-- name: GetLog10 :one
SELECT log10(1.0)
`
func (q *Queries) GetLog10(ctx context.Context) (float64, error) {
row := q.db.QueryRowContext(ctx, getLog10)
var log10 float64
err := row.Scan(&log10)
return log10, err
}
const getLog2 = `-- name: GetLog2 :one
SELECT log2(1.0)
`
func (q *Queries) GetLog2(ctx context.Context) (float64, error) {
row := q.db.QueryRowContext(ctx, getLog2)
var log2 float64
err := row.Scan(&log2)
return log2, err
}
const getLogBase = `-- name: GetLogBase :one
SELECT log(1.0, 2.0)
`
func (q *Queries) GetLogBase(ctx context.Context) (float64, error) {
row := q.db.QueryRowContext(ctx, getLogBase)
var log float64
err := row.Scan(&log)
return log, err
}
const getMod = `-- name: GetMod :one
SELECT mod(1, 2)
`
func (q *Queries) GetMod(ctx context.Context) (float64, error) {
row := q.db.QueryRowContext(ctx, getMod)
var mod float64
err := row.Scan(&mod)
return mod, err
}
const getPi = `-- name: GetPi :one
SELECT pi()
`
func (q *Queries) GetPi(ctx context.Context) (float64, error) {
row := q.db.QueryRowContext(ctx, getPi)
var pi float64
err := row.Scan(&pi)
return pi, err
}
const getPow = `-- name: GetPow :one
SELECT pow(1, 2)
`
func (q *Queries) GetPow(ctx context.Context) (float64, error) {
row := q.db.QueryRowContext(ctx, getPow)
var pow float64
err := row.Scan(&pow)
return pow, err
}
const getPower = `-- name: GetPower :one
SELECT power(1, 2)
`
func (q *Queries) GetPower(ctx context.Context) (float64, error) {
row := q.db.QueryRowContext(ctx, getPower)
var power float64
err := row.Scan(&power)
return power, err
}
const getRadians = `-- name: GetRadians :one
SELECT radians(1)
`
func (q *Queries) GetRadians(ctx context.Context) (float64, error) {
row := q.db.QueryRowContext(ctx, getRadians)
var radians float64
err := row.Scan(&radians)
return radians, err
}
const getSin = `-- name: GetSin :one
SELECT sin(1.0)
`
func (q *Queries) GetSin(ctx context.Context) (float64, error) {
row := q.db.QueryRowContext(ctx, getSin)
var sin float64
err := row.Scan(&sin)
return sin, err
}
const getSinh = `-- name: GetSinh :one
SELECT sinh(1.0)
`
func (q *Queries) GetSinh(ctx context.Context) (float64, error) {
row := q.db.QueryRowContext(ctx, getSinh)
var sinh float64
err := row.Scan(&sinh)
return sinh, err
}
const getSqrt = `-- name: GetSqrt :one
SELECT sqrt(1.0)
`
func (q *Queries) GetSqrt(ctx context.Context) (float64, error) {
row := q.db.QueryRowContext(ctx, getSqrt)
var sqrt float64
err := row.Scan(&sqrt)
return sqrt, err
}
const getTan = `-- name: GetTan :one
SELECT tan(1.0)
`
func (q *Queries) GetTan(ctx context.Context) (float64, error) {
row := q.db.QueryRowContext(ctx, getTan)
var tan float64
err := row.Scan(&tan)
return tan, err
}
const getTrunc = `-- name: GetTrunc :one
SELECT trunc(1.0)
`
func (q *Queries) GetTrunc(ctx context.Context) (float64, error) {
row := q.db.QueryRowContext(ctx, getTrunc)
var trunc float64
err := row.Scan(&trunc)
return trunc, err
}

View File

@@ -0,0 +1,11 @@
// Code generated by sqlc. DO NOT EDIT.
// versions:
// sqlc v1.31.1
package querytest
type Test struct {
ID int64
IntVal int64
TextVal string
}

View File

@@ -0,0 +1,561 @@
// Code generated by sqlc. DO NOT EDIT.
// versions:
// sqlc v1.31.1
// source: scalarfunc.sql
package querytest
import (
"context"
"database/sql"
)
const getAbs = `-- name: GetAbs :one
SELECT abs(int_val) FROM test
`
func (q *Queries) GetAbs(ctx context.Context) (float64, error) {
row := q.db.QueryRowContext(ctx, getAbs)
var abs float64
err := row.Scan(&abs)
return abs, err
}
const getChanges = `-- name: GetChanges :one
SELECT changes()
`
func (q *Queries) GetChanges(ctx context.Context) (int64, error) {
row := q.db.QueryRowContext(ctx, getChanges)
var changes int64
err := row.Scan(&changes)
return changes, err
}
const getChar1 = `-- name: GetChar1 :one
SELECT char(65)
`
func (q *Queries) GetChar1(ctx context.Context) (string, error) {
row := q.db.QueryRowContext(ctx, getChar1)
var char string
err := row.Scan(&char)
return char, err
}
const getChar3 = `-- name: GetChar3 :one
SELECT char(65, 66, 67)
`
func (q *Queries) GetChar3(ctx context.Context) (string, error) {
row := q.db.QueryRowContext(ctx, getChar3)
var char string
err := row.Scan(&char)
return char, err
}
const getCoalesce = `-- name: GetCoalesce :one
SELECT coalesce(NULL, 1, 'test')
`
func (q *Queries) GetCoalesce(ctx context.Context) (any, error) {
row := q.db.QueryRowContext(ctx, getCoalesce)
var coalesce any
err := row.Scan(&coalesce)
return coalesce, err
}
const getFormat = `-- name: GetFormat :one
SELECT format('Hello %s', 'world')
`
func (q *Queries) GetFormat(ctx context.Context) (string, error) {
row := q.db.QueryRowContext(ctx, getFormat)
var format string
err := row.Scan(&format)
return format, err
}
const getGlob = `-- name: GetGlob :one
SELECT glob('a*c', 'abc')
`
func (q *Queries) GetGlob(ctx context.Context) (int64, error) {
row := q.db.QueryRowContext(ctx, getGlob)
var glob int64
err := row.Scan(&glob)
return glob, err
}
const getHex = `-- name: GetHex :one
SELECT hex(123456)
`
func (q *Queries) GetHex(ctx context.Context) (string, error) {
row := q.db.QueryRowContext(ctx, getHex)
var hex string
err := row.Scan(&hex)
return hex, err
}
const getIfnull = `-- name: GetIfnull :one
SELECT ifnull(1, 2)
`
func (q *Queries) GetIfnull(ctx context.Context) (any, error) {
row := q.db.QueryRowContext(ctx, getIfnull)
var ifnull any
err := row.Scan(&ifnull)
return ifnull, err
}
const getIif = `-- name: GetIif :one
SELECT iif(1, 2, 3)
`
func (q *Queries) GetIif(ctx context.Context) (any, error) {
row := q.db.QueryRowContext(ctx, getIif)
var iif any
err := row.Scan(&iif)
return iif, err
}
const getInstr = `-- name: GetInstr :one
SELECT instr('hello', 'l')
`
func (q *Queries) GetInstr(ctx context.Context) (int64, error) {
row := q.db.QueryRowContext(ctx, getInstr)
var instr int64
err := row.Scan(&instr)
return instr, err
}
const getLastInsertRowID = `-- name: GetLastInsertRowID :one
SELECT last_insert_rowid()
`
func (q *Queries) GetLastInsertRowID(ctx context.Context) (int64, error) {
row := q.db.QueryRowContext(ctx, getLastInsertRowID)
var last_insert_rowid int64
err := row.Scan(&last_insert_rowid)
return last_insert_rowid, err
}
const getLength = `-- name: GetLength :one
SELECT length('12345')
`
func (q *Queries) GetLength(ctx context.Context) (int64, error) {
row := q.db.QueryRowContext(ctx, getLength)
var length int64
err := row.Scan(&length)
return length, err
}
const getLike2 = `-- name: GetLike2 :one
SELECT like('%bc%', 'abcd')
`
func (q *Queries) GetLike2(ctx context.Context) (int64, error) {
row := q.db.QueryRowContext(ctx, getLike2)
var like int64
err := row.Scan(&like)
return like, err
}
const getLike3 = `-- name: GetLike3 :one
SELECT like('$%1%', '%100', '$')
`
func (q *Queries) GetLike3(ctx context.Context) (int64, error) {
row := q.db.QueryRowContext(ctx, getLike3)
var like int64
err := row.Scan(&like)
return like, err
}
const getLikelihood = `-- name: GetLikelihood :one
SELECT likelihood('12345', 0.5)
`
func (q *Queries) GetLikelihood(ctx context.Context) (any, error) {
row := q.db.QueryRowContext(ctx, getLikelihood)
var likelihood any
err := row.Scan(&likelihood)
return likelihood, err
}
const getLikely = `-- name: GetLikely :one
SELECT likely('12345')
`
func (q *Queries) GetLikely(ctx context.Context) (any, error) {
row := q.db.QueryRowContext(ctx, getLikely)
var likely any
err := row.Scan(&likely)
return likely, err
}
const getLower = `-- name: GetLower :one
SELECT lower('ABCDE')
`
func (q *Queries) GetLower(ctx context.Context) (string, error) {
row := q.db.QueryRowContext(ctx, getLower)
var lower string
err := row.Scan(&lower)
return lower, err
}
const getLtrim = `-- name: GetLtrim :one
SELECT ltrim(' ABCDE')
`
func (q *Queries) GetLtrim(ctx context.Context) (string, error) {
row := q.db.QueryRowContext(ctx, getLtrim)
var ltrim string
err := row.Scan(&ltrim)
return ltrim, err
}
const getLtrim2 = `-- name: GetLtrim2 :one
SELECT ltrim(':ABCDE', ':')
`
func (q *Queries) GetLtrim2(ctx context.Context) (string, error) {
row := q.db.QueryRowContext(ctx, getLtrim2)
var ltrim string
err := row.Scan(&ltrim)
return ltrim, err
}
const getMax3 = `-- name: GetMax3 :one
SELECT max(1, 3, 2)
`
func (q *Queries) GetMax3(ctx context.Context) (any, error) {
row := q.db.QueryRowContext(ctx, getMax3)
var max any
err := row.Scan(&max)
return max, err
}
const getMin3 = `-- name: GetMin3 :one
SELECT min(1, 3, 2)
`
func (q *Queries) GetMin3(ctx context.Context) (any, error) {
row := q.db.QueryRowContext(ctx, getMin3)
var min any
err := row.Scan(&min)
return min, err
}
const getNullif = `-- name: GetNullif :one
SELECT nullif(1, 2)
`
func (q *Queries) GetNullif(ctx context.Context) (any, error) {
row := q.db.QueryRowContext(ctx, getNullif)
var nullif any
err := row.Scan(&nullif)
return nullif, err
}
const getPrintf = `-- name: GetPrintf :one
SELECT printf('Hello %s', 'world')
`
func (q *Queries) GetPrintf(ctx context.Context) (string, error) {
row := q.db.QueryRowContext(ctx, getPrintf)
var printf string
err := row.Scan(&printf)
return printf, err
}
const getQuote = `-- name: GetQuote :one
SELECT quote(1)
`
func (q *Queries) GetQuote(ctx context.Context) (string, error) {
row := q.db.QueryRowContext(ctx, getQuote)
var quote string
err := row.Scan(&quote)
return quote, err
}
const getRandom = `-- name: GetRandom :one
SELECT random()
`
func (q *Queries) GetRandom(ctx context.Context) (int64, error) {
row := q.db.QueryRowContext(ctx, getRandom)
var random int64
err := row.Scan(&random)
return random, err
}
const getRandomBlob = `-- name: GetRandomBlob :one
SELECT randomblob(16)
`
func (q *Queries) GetRandomBlob(ctx context.Context) ([]byte, error) {
row := q.db.QueryRowContext(ctx, getRandomBlob)
var randomblob []byte
err := row.Scan(&randomblob)
return randomblob, err
}
const getReplace = `-- name: GetReplace :one
SELECT replace('abc', 'bc', 'df')
`
func (q *Queries) GetReplace(ctx context.Context) (string, error) {
row := q.db.QueryRowContext(ctx, getReplace)
var replace string
err := row.Scan(&replace)
return replace, err
}
const getRound = `-- name: GetRound :one
SELECT round(1.1)
`
func (q *Queries) GetRound(ctx context.Context) (float64, error) {
row := q.db.QueryRowContext(ctx, getRound)
var round float64
err := row.Scan(&round)
return round, err
}
const getRound2 = `-- name: GetRound2 :one
SELECT round(1.1, 2)
`
func (q *Queries) GetRound2(ctx context.Context) (float64, error) {
row := q.db.QueryRowContext(ctx, getRound2)
var round float64
err := row.Scan(&round)
return round, err
}
const getRtrim = `-- name: GetRtrim :one
SELECT rtrim('ABCDE ')
`
func (q *Queries) GetRtrim(ctx context.Context) (string, error) {
row := q.db.QueryRowContext(ctx, getRtrim)
var rtrim string
err := row.Scan(&rtrim)
return rtrim, err
}
const getRtrim2 = `-- name: GetRtrim2 :one
SELECT rtrim('ABCDE:', ':')
`
func (q *Queries) GetRtrim2(ctx context.Context) (string, error) {
row := q.db.QueryRowContext(ctx, getRtrim2)
var rtrim string
err := row.Scan(&rtrim)
return rtrim, err
}
const getSQLiteCompileOptionGet = `-- name: GetSQLiteCompileOptionGet :one
SELECT sqlite_compileoption_get(1)
`
func (q *Queries) GetSQLiteCompileOptionGet(ctx context.Context) (sql.NullString, error) {
row := q.db.QueryRowContext(ctx, getSQLiteCompileOptionGet)
var sqlite_compileoption_get sql.NullString
err := row.Scan(&sqlite_compileoption_get)
return sqlite_compileoption_get, err
}
const getSQLiteCompileOptionUsed = `-- name: GetSQLiteCompileOptionUsed :one
SELECT sqlite_compileoption_used(1)
`
func (q *Queries) GetSQLiteCompileOptionUsed(ctx context.Context) (int64, error) {
row := q.db.QueryRowContext(ctx, getSQLiteCompileOptionUsed)
var sqlite_compileoption_used int64
err := row.Scan(&sqlite_compileoption_used)
return sqlite_compileoption_used, err
}
const getSQLiteSourceID = `-- name: GetSQLiteSourceID :one
SELECT sqlite_source_id()
`
func (q *Queries) GetSQLiteSourceID(ctx context.Context) (string, error) {
row := q.db.QueryRowContext(ctx, getSQLiteSourceID)
var sqlite_source_id string
err := row.Scan(&sqlite_source_id)
return sqlite_source_id, err
}
const getSQLiteVersion = `-- name: GetSQLiteVersion :one
SELECT sqlite_version()
`
func (q *Queries) GetSQLiteVersion(ctx context.Context) (string, error) {
row := q.db.QueryRowContext(ctx, getSQLiteVersion)
var sqlite_version string
err := row.Scan(&sqlite_version)
return sqlite_version, err
}
const getSign = `-- name: GetSign :one
SELECT sign(1)
`
func (q *Queries) GetSign(ctx context.Context) (sql.NullInt64, error) {
row := q.db.QueryRowContext(ctx, getSign)
var sign sql.NullInt64
err := row.Scan(&sign)
return sign, err
}
const getSoundex = `-- name: GetSoundex :one
SELECT soundex('abc')
`
func (q *Queries) GetSoundex(ctx context.Context) (any, error) {
row := q.db.QueryRowContext(ctx, getSoundex)
var soundex any
err := row.Scan(&soundex)
return soundex, err
}
const getSubstr2 = `-- name: GetSubstr2 :one
SELECT substr('abcdef', 2)
`
func (q *Queries) GetSubstr2(ctx context.Context) (string, error) {
row := q.db.QueryRowContext(ctx, getSubstr2)
var substr string
err := row.Scan(&substr)
return substr, err
}
const getSubstr3 = `-- name: GetSubstr3 :one
SELECT substr('abcdef', 1, 2)
`
func (q *Queries) GetSubstr3(ctx context.Context) (string, error) {
row := q.db.QueryRowContext(ctx, getSubstr3)
var substr string
err := row.Scan(&substr)
return substr, err
}
const getSubstring2 = `-- name: GetSubstring2 :one
SELECT substring('abcdef', 1)
`
func (q *Queries) GetSubstring2(ctx context.Context) (string, error) {
row := q.db.QueryRowContext(ctx, getSubstring2)
var substring string
err := row.Scan(&substring)
return substring, err
}
const getSusbstring3 = `-- name: GetSusbstring3 :one
SELECT substring('abcdef', 1, 2)
`
func (q *Queries) GetSusbstring3(ctx context.Context) (string, error) {
row := q.db.QueryRowContext(ctx, getSusbstring3)
var substring string
err := row.Scan(&substring)
return substring, err
}
const getTotalChanges = `-- name: GetTotalChanges :one
SELECT total_changes()
`
func (q *Queries) GetTotalChanges(ctx context.Context) (int64, error) {
row := q.db.QueryRowContext(ctx, getTotalChanges)
var total_changes int64
err := row.Scan(&total_changes)
return total_changes, err
}
const getTrim = `-- name: GetTrim :one
SELECT trim(' ABCDE ')
`
func (q *Queries) GetTrim(ctx context.Context) (string, error) {
row := q.db.QueryRowContext(ctx, getTrim)
var trim string
err := row.Scan(&trim)
return trim, err
}
const getTrim2 = `-- name: GetTrim2 :one
SELECT trim(':ABCDE:', ':')
`
func (q *Queries) GetTrim2(ctx context.Context) (string, error) {
row := q.db.QueryRowContext(ctx, getTrim2)
var trim string
err := row.Scan(&trim)
return trim, err
}
const getTypeof = `-- name: GetTypeof :one
SELECT typeof('ABCDE')
`
func (q *Queries) GetTypeof(ctx context.Context) (string, error) {
row := q.db.QueryRowContext(ctx, getTypeof)
var typeof string
err := row.Scan(&typeof)
return typeof, err
}
const getUnicode = `-- name: GetUnicode :one
SELECT unicode('A')
`
func (q *Queries) GetUnicode(ctx context.Context) (int64, error) {
row := q.db.QueryRowContext(ctx, getUnicode)
var unicode int64
err := row.Scan(&unicode)
return unicode, err
}
const getUnlikely = `-- name: GetUnlikely :one
SELECT unlikely('12345')
`
func (q *Queries) GetUnlikely(ctx context.Context) (any, error) {
row := q.db.QueryRowContext(ctx, getUnlikely)
var unlikely any
err := row.Scan(&unlikely)
return unlikely, err
}
const getUpper = `-- name: GetUpper :one
SELECT upper('abcde')
`
func (q *Queries) GetUpper(ctx context.Context) (string, error) {
row := q.db.QueryRowContext(ctx, getUpper)
var upper string
err := row.Scan(&upper)
return upper, err
}
const getZeroblob = `-- name: GetZeroblob :one
SELECT zeroblob(16)
`
func (q *Queries) GetZeroblob(ctx context.Context) ([]byte, error) {
row := q.db.QueryRowContext(ctx, getZeroblob)
var zeroblob []byte
err := row.Scan(&zeroblob)
return zeroblob, err
}

View File

@@ -0,0 +1,41 @@
-- name: GetAvg :one
SELECT avg(int_val) FROM test;
-- name: GetCount :one
SELECT count(*) FROM test;
-- name: GetCountId :one
SELECT count(id) FROM test;
-- name: GetGroupConcatInt :one
SELECT group_concat(int_val) FROM test;
-- name: GetGroupConcatInt2 :one
SELECT group_concat(1, ':') FROM test;
-- name: GetGroupConcatText :one
SELECT group_concat(text_val) FROM test;
-- name: GetGroupConcatText2 :one
SELECT group_concat(text_val, ':') FROM test;
-- name: GetMaxInt :one
SELECT max(int_val) FROM test;
-- name: GetMaxText :one
SELECT max(text_val) FROM test;
-- name: GetMinInt :one
SELECT min(int_val) FROM test;
-- name: GetMinText :one
SELECT min(text_val) FROM test;
-- name: GetSumInt :one
SELECT sum(int_val) FROM test;
-- name: GetSumText :one
SELECT sum(text_val) FROM test;
-- name: GetTotalInt :one
SELECT total(int_val) FROM test;

View File

@@ -0,0 +1,86 @@
-- name: GetAcos :one
SELECT acos(1.0);
-- name: GetAcosh :one
SELECT acosh(1.0);
-- name: GetAsin :one
SELECT asin(1.0);
-- name: GetAsinh :one
SELECT asinh(1.0);
-- name: GetAtan :one
SELECT atan(1.0);
-- name: GetAtan2 :one
SELECT atan2(1.0, 0.5);
-- name: GetAtanh :one
SELECT atanh(1.0);
-- name: GetCeil :one
SELECT ceil(1.0);
-- name: GetCeilin :one
SELECT ceiling(1.0);
-- name: GetCos :one
SELECT cos(1.0);
-- name: GetCosh :one
SELECT cosh(1.0);
-- name: GetDegrees :one
SELECT degrees(1.0);
-- name: GetExp :one
SELECT exp(1.0);
-- name: GetFloor :one
SELECT floor(1.0);
-- name: GetLn :one
SELECT ln(1.0);
-- name: GetLog :one
SELECT log(1.0);
-- name: GetLog10 :one
SELECT log10(1.0);
-- name: GetLogBase :one
SELECT log(1.0, 2.0);
-- name: GetLog2 :one
SELECT log2(1.0);
-- name: GetMod :one
SELECT mod(1, 2);
-- name: GetPi :one
SELECT pi();
-- name: GetPow :one
SELECT pow(1, 2);
-- name: GetPower :one
SELECT power(1, 2);
-- name: GetRadians :one
SELECT radians(1);
-- name: GetSin :one
SELECT sin(1.0);
-- name: GetSinh :one
SELECT sinh(1.0);
-- name: GetSqrt :one
SELECT sqrt(1.0);
-- name: GetTan :one
SELECT tan(1.0);
-- name: GetTrunc :one
SELECT trunc(1.0);

View File

@@ -0,0 +1,149 @@
-- name: GetAbs :one
SELECT abs(int_val) FROM test;
-- name: GetChanges :one
SELECT changes();
-- name: GetChar1 :one
SELECT char(65);
-- name: GetChar3 :one
SELECT char(65, 66, 67);
-- name: GetCoalesce :one
SELECT coalesce(NULL, 1, 'test');
-- name: GetFormat :one
SELECT format('Hello %s', 'world');
-- name: GetGlob :one
SELECT glob('a*c', 'abc');
-- name: GetHex :one
SELECT hex(123456);
-- name: GetIfnull :one
SELECT ifnull(1, 2);
-- name: GetIif :one
SELECT iif(1, 2, 3);
-- name: GetLastInsertRowID :one
SELECT last_insert_rowid();
-- name: GetInstr :one
SELECT instr('hello', 'l');
-- name: GetLength :one
SELECT length('12345');
-- name: GetLike2 :one
SELECT like('%bc%', 'abcd');
-- name: GetLike3 :one
SELECT like('$%1%', '%100', '$');
-- name: GetLikelihood :one
SELECT likelihood('12345', 0.5);
-- name: GetLikely :one
SELECT likely('12345');
-- name: GetLower :one
SELECT lower('ABCDE');
-- name: GetLtrim :one
SELECT ltrim(' ABCDE');
-- name: GetLtrim2 :one
SELECT ltrim(':ABCDE', ':');
-- name: GetMax3 :one
SELECT max(1, 3, 2);
-- name: GetMin3 :one
SELECT min(1, 3, 2);
-- name: GetNullif :one
SELECT nullif(1, 2);
-- name: GetPrintf :one
SELECT printf('Hello %s', 'world');
-- name: GetQuote :one
SELECT quote(1);
-- name: GetRandom :one
SELECT random();
-- name: GetRandomBlob :one
SELECT randomblob(16);
-- name: GetRound :one
SELECT round(1.1);
-- name: GetRound2 :one
SELECT round(1.1, 2);
-- name: GetReplace :one
SELECT replace('abc', 'bc', 'df');
-- name: GetRtrim :one
SELECT rtrim('ABCDE ');
-- name: GetRtrim2 :one
SELECT rtrim('ABCDE:', ':');
-- name: GetSign :one
SELECT sign(1);
-- name: GetSoundex :one
SELECT soundex('abc');
-- name: GetSQLiteCompileOptionGet :one
SELECT sqlite_compileoption_get(1);
-- name: GetSQLiteCompileOptionUsed :one
SELECT sqlite_compileoption_used(1);
-- name: GetSQLiteSourceID :one
SELECT sqlite_source_id();
-- name: GetSQLiteVersion :one
SELECT sqlite_version();
-- name: GetSubstr3 :one
SELECT substr('abcdef', 1, 2);
-- name: GetSubstr2 :one
SELECT substr('abcdef', 2);
-- name: GetSusbstring3 :one
SELECT substring('abcdef', 1, 2);
-- name: GetSubstring2 :one
SELECT substring('abcdef', 1);
-- name: GetTotalChanges :one
SELECT total_changes();
-- name: GetTrim :one
SELECT trim(' ABCDE ');
-- name: GetTrim2 :one
SELECT trim(':ABCDE:', ':');
-- name: GetTypeof :one
SELECT typeof('ABCDE');
-- name: GetUnicode :one
SELECT unicode('A');
-- name: GetUnlikely :one
SELECT unlikely('12345');
-- name: GetUpper :one
SELECT upper('abcde');
-- name: GetZeroblob :one
SELECT zeroblob(16);

View File

@@ -0,0 +1,6 @@
CREATE TABLE test (
id integer NOT NULL PRIMARY KEY AUTOINCREMENT,
int_val integer NOT NULL,
text_val text NOT NULL
);

View File

@@ -0,0 +1,12 @@
{
"version": "1",
"packages": [
{
"path": "go",
"name": "querytest",
"schema": "schema.sql",
"queries": "queries/",
"engine": "sqlite"
}
]
}