mirror of
https://github.com/ent/ent.git
synced 2026-05-24 09:31:56 +03:00
quote table name on DESCRIBE statement (#7)
Summary: Pull Request resolved: https://github.com/facebookincubator/ent/pull/7 avoid conflicting with reserved words (e.g. "groups" became reserved word in MySQL 8.x) Reviewed By: alexsn Differential Revision: D15957279 fbshipit-source-id: b6944752c7e5f6ec37119b11cc0ab8a0d7d3a7ff
This commit is contained in:
committed by
Facebook Github Bot
parent
5ca9494121
commit
0e605681b2
@@ -257,6 +257,25 @@ func (t *TableBuilder) Query() (string, []interface{}) {
|
||||
return t.b.String(), t.b.args
|
||||
}
|
||||
|
||||
// DescribeBuilder is a query builder for `DESCRIBE` statement.
|
||||
type DescribeBuilder struct {
|
||||
b Builder
|
||||
name string // table name.
|
||||
}
|
||||
|
||||
// Describe returns a query builder for the `DESCRIBE` statement.
|
||||
//
|
||||
// Describe("users")
|
||||
//
|
||||
func Describe(name string) *DescribeBuilder { return &DescribeBuilder{b: Builder{}, name: name} }
|
||||
|
||||
// Query returns query representation of a `DESCRIBE` statement.
|
||||
func (t *DescribeBuilder) Query() (string, []interface{}) {
|
||||
t.b.WriteString("DESCRIBE ")
|
||||
t.b.Append(t.name)
|
||||
return t.b.String(), nil
|
||||
}
|
||||
|
||||
// TableAlter is a query builder for `ALTER TABLE` statement.
|
||||
type TableAlter struct {
|
||||
b Builder
|
||||
|
||||
Reference in New Issue
Block a user