sql

package
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 16, 2024 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AvgAggregator added in v0.3.0

func AvgAggregator(table exp.AliasedExpression, fields []builders.Field) (goqu.Expression, error)

func BuildQuery added in v0.3.0

func BuildQuery(ctx context.Context, builder Builder) (string, []any, error)

func Collect added in v0.3.0

func Collect[T any](ctx context.Context, querier pgxscan.Querier, toFunc pgx.RowToFunc[T], q string, args ...any) ([]T, error)

func Eq

func Eq(table exp.AliasedExpression, key string, value interface{}) goqu.Expression

func ExecuteQuery added in v0.3.0

func ExecuteQuery(ctx context.Context, querier pgxscan.Querier, scanner func(rows pgx.Rows) error, q string, args ...any) error

func Gt

func Gt(table exp.AliasedExpression, key string, value interface{}) goqu.Expression

func Gte

func Gte(table exp.AliasedExpression, key string, value interface{}) goqu.Expression

func ILike

func ILike(table exp.AliasedExpression, key string, value interface{}) goqu.Expression

func In

func In(table exp.AliasedExpression, key string, value interface{}) goqu.Expression

func IsNull

func IsNull(table exp.AliasedExpression, key string, value interface{}) goqu.Expression

func Like

func Like(table exp.AliasedExpression, key string, value interface{}) goqu.Expression

func Lt

func Lt(table exp.AliasedExpression, key string, value interface{}) goqu.Expression

func Lte

func Lte(table exp.AliasedExpression, key string, value interface{}) goqu.Expression

func MaxAggregator

func MaxAggregator(table exp.AliasedExpression, fields []builders.Field) (goqu.Expression, error)

func MinAggregator

func MinAggregator(table exp.AliasedExpression, fields []builders.Field) (goqu.Expression, error)

func Neq

func Neq(table exp.AliasedExpression, key string, value interface{}) goqu.Expression

func NotIn

func NotIn(table exp.AliasedExpression, key string, value interface{}) goqu.Expression

func SumAggregator added in v0.3.0

func SumAggregator(table exp.AliasedExpression, fields []builders.Field) (goqu.Expression, error)

Types

type Builder

type Builder struct {
	Schema              *ast.Schema
	Logger              log.Logger
	TableNameGenerator  builders.TableNameGenerator
	Operators           map[string]builders.Operator
	AggregatorOperators map[string]builders.AggregatorOperator
	CaseConverter       builders.ColumnCaseConverter
}

func NewBuilder

func NewBuilder(config *builders.Config) Builder

func (Builder) Create

func (b Builder) Create(field builders.Field) (string, []any, error)

Create generates an SQL create query based on graphql ast.

func (Builder) Delete

func (b Builder) Delete(field builders.Field) (string, []any, error)

Delete generates an SQL delete query based on graphql ast.

func (Builder) Query

func (b Builder) Query(field builders.Field) (string, []any, error)

Query generates an SQL read query based on graphql ast.

func (Builder) Update

func (b Builder) Update(field builders.Field) (string, []any, error)

Update generates an SQL update query based on graphql ast.

type Driver

type Driver struct {
	// contains filtered or unexported fields
}

Driver is a dialect.Driver implementation for SQL based databases.

func NewDriver

func NewDriver(dialect string, cfg *builders.Config, pool *pgxpool.Pool) *Driver

NewDriver creates a new Driver with the given Conn and dialect.

func (Driver) Close

func (d Driver) Close() error

func (Driver) Dialect

func (d Driver) Dialect() string

func (Driver) Scan

func (d Driver) Scan(ctx context.Context, model interface{}) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL