Documentation ¶
Overview ¶
Inspired by Pipe-Syntax-In-SQL https://static.simonwillison.net/static/2024/Pipe-Syntax-In-SQL.html +gengo:runtimedoc=false
Index ¶
- func Columns[M Model](cols ...modelscoped.Column[M]) iter.Seq[modelscoped.Column[M]]
- type Embed
- type Filter
- type FilterOp
- type FromOptionFunc
- type LimitOption
- type LimitOptionFunc
- type Model
- type ModelNewer
- type OperatorType
- type Source
- func Aggregate[S Model, O Model](src Source[S], cols ...modelscoped.Column[O]) Source[O]
- func AggregateGroupBy[S Model, O Model](src Source[S], by iter.Seq[modelscoped.Column[S]], ...) Source[O]
- func As[M Model](src Source[M], name string) Source[M]
- func From[M Model](opts ...FromOptionFunc[M]) Source[M]
- func FromAll[M Model](opts ...FromOptionFunc[M]) Source[M]
- func InsertFrom[S Model, O Model](src Source[S], cols ...modelscoped.Column[O]) Source[O]
- func Pipe[M Model](src Source[M], operators ...SourceOperator[M]) Source[M]
- func Value[M Model](value *M, cols ...modelscoped.Column[M]) Source[M]
- func ValueOmitZero[M Model](value *M, exclude ...modelscoped.Column[M]) Source[M]
- func Values[Slice ~[]*M, M Model](values Slice, cols ...modelscoped.Column[M]) Source[M]
- type SourceOperator
- func AscSort[M Model](col modelscoped.Column[M]) SourceOperator[M]
- func CastAscSort[M Model, U Model](col modelscoped.Column[U]) SourceOperator[M]
- func CastDescSort[M Model, U Model](col modelscoped.Column[U]) SourceOperator[M]
- func CastOrWhere[M Model, U Model, T comparable](col modelscoped.TypedColumn[U, T], valuer sqlbuilder.ColumnValuer[T]) SourceOperator[M]
- func CastSelect[M Model, U Model](cols ...modelscoped.Column[U]) SourceOperator[M]
- func CastWhere[M Model, U Model, T comparable](col modelscoped.TypedColumn[U, T], valuer sqlbuilder.ColumnValuer[T]) SourceOperator[M]
- func DefaultProject[M Model](projects ...sqlfrag.Fragment) SourceOperator[M]
- func DescSort[M Model](col modelscoped.Column[M]) SourceOperator[M]
- func DoDelete[M Model]() SourceOperator[M]
- func DoDeleteHard[M Model]() SourceOperator[M]
- func DoUpdate[M Model, T any](col modelscoped.TypedColumn[M, T], valuer sqlbuilder.ColumnValuer[T]) SourceOperator[M]
- func DoUpdateSet[M Model](m *M, cols ...modelscoped.Column[M]) SourceOperator[M]
- func DoUpdateSetOmitZero[M Model](m *M, exclude ...modelscoped.Column[M]) SourceOperator[M]
- func Limit[M Model](limit int64, optFns ...LimitOptionFunc) SourceOperator[M]
- func NewWhere[M Model, T comparable](op FilterOp, col modelscoped.TypedColumn[M, T], ...) SourceOperator[M]
- func OnConflictDoNothing[M sqlbuilder.Model](cols modelscoped.ColumnSeq[M]) SourceOperator[M]
- func OnConflictDoUpdateSet[M sqlbuilder.Model](cols modelscoped.ColumnSeq[M], toUpdates ...modelscoped.Column[M]) SourceOperator[M]
- func OnConflictDoWith[M sqlbuilder.Model](cols modelscoped.ColumnSeq[M], ...) SourceOperator[M]
- func OrWhere[M Model, T comparable](col modelscoped.TypedColumn[M, T], valuer sqlbuilder.ColumnValuer[T]) SourceOperator[M]
- func Project[M Model](projects ...sqlfrag.Fragment) SourceOperator[M]
- func Returning[M Model](cols ...modelscoped.Column[M]) SourceOperator[M]
- func Select[M Model](cols ...modelscoped.Column[M]) SourceOperator[M]
- func SourceOperatorFunc[M Model](typ OperatorType, next func(in Source[M]) Source[M]) SourceOperator[M]
- func Where[M Model, T comparable](col modelscoped.TypedColumn[M, T], valuer sqlbuilder.ColumnValuer[T]) SourceOperator[M]
- func WhereInSelectFrom[M Model, S Model, T comparable](col modelscoped.TypedColumn[M, T], colSelect modelscoped.TypedColumn[S, T], ...) SourceOperator[M]
- func WhereNotInSelectFrom[M Model, S Model, T comparable](col modelscoped.TypedColumn[M, T], colSelect modelscoped.TypedColumn[S, T], ...) SourceOperator[M]
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Columns ¶
func Columns[M Model](cols ...modelscoped.Column[M]) iter.Seq[modelscoped.Column[M]]
Types ¶
type FromOptionFunc ¶
type FromOptionFunc[M Model] func(x *sourceFrom[M])
func JoinOn ¶
func JoinOn[M Model, B Model, S Model, T comparable]( on modelscoped.TypedColumn[B, T], src modelscoped.TypedColumn[S, T], ) FromOptionFunc[M]
type LimitOption ¶
type LimitOption interface {
SetOffset(offset int64)
}
type LimitOptionFunc ¶
type LimitOptionFunc = func(o LimitOption)
func Offset ¶
func Offset(offset int64) LimitOptionFunc
type Model ¶
type Model = sqlbuilder.Model
type ModelNewer ¶
type ModelNewer[M Model] sqlbuilder.ModelNewer[M]
type OperatorType ¶
type OperatorType uint
const ( OperatorFilter OperatorType = iota + 1 OperatorSort OperatorLimit OperatorOnConflict OperatorProject OperatorCommit OperatorSetting )
type Source ¶
type Source[M Model] interface { Pipe(operators ...SourceOperator[M]) Source[M] sqlfrag.Fragment internal.StmtPatcher[M] }
func AggregateGroupBy ¶
func AggregateGroupBy[S Model, O Model](src Source[S], by iter.Seq[modelscoped.Column[S]], cols ...modelscoped.Column[O]) Source[O]
func From ¶
func From[M Model](opts ...FromOptionFunc[M]) Source[M]
func FromAll ¶
func FromAll[M Model](opts ...FromOptionFunc[M]) Source[M]
func InsertFrom ¶
func ValueOmitZero ¶
func ValueOmitZero[M Model](value *M, exclude ...modelscoped.Column[M]) Source[M]
type SourceOperator ¶
type SourceOperator[M Model] interface { internal.Operator[Source[M], Source[M]] OperatorType() OperatorType }
func AscSort ¶
func AscSort[M Model](col modelscoped.Column[M]) SourceOperator[M]
func CastAscSort ¶
func CastAscSort[M Model, U Model](col modelscoped.Column[U]) SourceOperator[M]
func CastDescSort ¶
func CastDescSort[M Model, U Model](col modelscoped.Column[U]) SourceOperator[M]
func CastOrWhere ¶
func CastOrWhere[M Model, U Model, T comparable](col modelscoped.TypedColumn[U, T], valuer sqlbuilder.ColumnValuer[T]) SourceOperator[M]
func CastSelect ¶
func CastSelect[M Model, U Model](cols ...modelscoped.Column[U]) SourceOperator[M]
func CastWhere ¶
func CastWhere[M Model, U Model, T comparable](col modelscoped.TypedColumn[U, T], valuer sqlbuilder.ColumnValuer[T]) SourceOperator[M]
func DefaultProject ¶
func DefaultProject[M Model](projects ...sqlfrag.Fragment) SourceOperator[M]
func DescSort ¶
func DescSort[M Model](col modelscoped.Column[M]) SourceOperator[M]
func DoDelete ¶
func DoDelete[M Model]() SourceOperator[M]
func DoDeleteHard ¶
func DoDeleteHard[M Model]() SourceOperator[M]
func DoUpdate ¶
func DoUpdate[M Model, T any](col modelscoped.TypedColumn[M, T], valuer sqlbuilder.ColumnValuer[T]) SourceOperator[M]
func DoUpdateSet ¶
func DoUpdateSet[M Model](m *M, cols ...modelscoped.Column[M]) SourceOperator[M]
func DoUpdateSetOmitZero ¶
func DoUpdateSetOmitZero[M Model](m *M, exclude ...modelscoped.Column[M]) SourceOperator[M]
func Limit ¶
func Limit[M Model](limit int64, optFns ...LimitOptionFunc) SourceOperator[M]
func NewWhere ¶
func NewWhere[M Model, T comparable](op FilterOp, col modelscoped.TypedColumn[M, T], valuer sqlbuilder.ColumnValuer[T]) SourceOperator[M]
func OnConflictDoNothing ¶
func OnConflictDoNothing[M sqlbuilder.Model](cols modelscoped.ColumnSeq[M]) SourceOperator[M]
func OnConflictDoUpdateSet ¶
func OnConflictDoUpdateSet[M sqlbuilder.Model](cols modelscoped.ColumnSeq[M], toUpdates ...modelscoped.Column[M]) SourceOperator[M]
func OnConflictDoWith ¶
func OnConflictDoWith[M sqlbuilder.Model]( cols modelscoped.ColumnSeq[M], with func(onConflictAddition sqlbuilder.OnConflictAddition) sqlbuilder.OnConflictAddition, ) SourceOperator[M]
func OrWhere ¶
func OrWhere[M Model, T comparable](col modelscoped.TypedColumn[M, T], valuer sqlbuilder.ColumnValuer[T]) SourceOperator[M]
func Returning ¶
func Returning[M Model](cols ...modelscoped.Column[M]) SourceOperator[M]
func Select ¶
func Select[M Model](cols ...modelscoped.Column[M]) SourceOperator[M]
func SourceOperatorFunc ¶
func SourceOperatorFunc[M Model](typ OperatorType, next func(in Source[M]) Source[M]) SourceOperator[M]
func Where ¶
func Where[M Model, T comparable](col modelscoped.TypedColumn[M, T], valuer sqlbuilder.ColumnValuer[T]) SourceOperator[M]
func WhereInSelectFrom ¶
func WhereInSelectFrom[M Model, S Model, T comparable](col modelscoped.TypedColumn[M, T], colSelect modelscoped.TypedColumn[S, T], source Source[S]) SourceOperator[M]
func WhereNotInSelectFrom ¶
func WhereNotInSelectFrom[M Model, S Model, T comparable](col modelscoped.TypedColumn[M, T], colSelect modelscoped.TypedColumn[S, T], source Source[S]) SourceOperator[M]
Source Files ¶
- doc.go
- embed.go
- operator.go
- operator__commit_do_delete_or_update.go
- operator__filter.go
- operator__limit.go
- operator__on_conflict.go
- operator__project.go
- operator__sort.go
- source.go
- source__alias.go
- source__from.go
- source__join.go
- source__values.go
- transformer__aggregate.go
- transformer__insert_from.go
- util.go
Click to show internal directories.
Click to hide internal directories.