Fix primary key tag

This commit is contained in:
Jinzhu
2020-03-12 08:39:42 +08:00
parent 9e8a4db36b
commit af080e6773
13 changed files with 58 additions and 66 deletions
-41
View File
@@ -6,23 +6,6 @@ type From struct {
Joins []Join
}
type JoinType string
const (
CrossJoin JoinType = "CROSS"
InnerJoin = "INNER"
LeftJoin = "LEFT"
RightJoin = "RIGHT"
)
// Join join clause for from
type Join struct {
Type JoinType
Table Table
ON Where
Using []string
}
// Name from clause name
func (from From) Name() string {
return "FROM"
@@ -48,30 +31,6 @@ func (from From) Build(builder Builder) {
}
}
func (join Join) Build(builder Builder) {
if join.Type != "" {
builder.WriteString(string(join.Type))
builder.WriteByte(' ')
}
builder.WriteString("JOIN ")
builder.WriteQuoted(join.Table)
if len(join.ON.Exprs) > 0 {
builder.WriteString(" ON ")
join.ON.Build(builder)
} else if len(join.Using) > 0 {
builder.WriteString(" USING (")
for idx, c := range join.Using {
if idx > 0 {
builder.WriteByte(',')
}
builder.WriteQuoted(c)
}
builder.WriteByte(')')
}
}
// MergeClause merge from clause
func (from From) MergeClause(clause *Clause) {
if v, ok := clause.Expression.(From); ok {