Source File
clause.go
Belonging Package
gorm.io/gorm/clause
package clause// Interface clause interfacetype Interface interface {Name() stringBuild(Builder)MergeClause(*Clause)}// ClauseBuilder clause builder, allows to customize how to build clausetype ClauseBuilder func(Clause, Builder)type Writer interface {WriteByte(byte) errorWriteString(string) (int, error)}// Builder builder interfacetype Builder interface {WriterWriteQuoted(field interface{})AddVar(Writer, ...interface{})AddError(error) error}// Clausetype Clause struct {Name string // WHEREBeforeExpression ExpressionAfterNameExpression ExpressionAfterExpression ExpressionExpression ExpressionBuilder ClauseBuilder}// Build build clausefunc ( Clause) ( Builder) {if .Builder != nil {.Builder(, )} else if .Expression != nil {if .BeforeExpression != nil {.BeforeExpression.Build().WriteByte(' ')}if .Name != "" {.WriteString(.Name).WriteByte(' ')}if .AfterNameExpression != nil {.AfterNameExpression.Build().WriteByte(' ')}.Expression.Build()if .AfterExpression != nil {.WriteByte(' ').AfterExpression.Build()}}}const (PrimaryKey string = "~~~py~~~" // primary keyCurrentTable string = "~~~ct~~~" // current tableAssociations string = "~~~as~~~" // associations)var (currentTable = Table{Name: CurrentTable}PrimaryColumn = Column{Table: CurrentTable, Name: PrimaryKey})// Column quote with nametype Column struct {Table stringName stringAlias stringRaw bool}// Table quote with nametype Table struct {Name stringAlias stringRaw bool}
![]() |
The pages are generated with Golds v0.6.7. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds. |