summaryrefslogtreecommitdiff
path: root/vendor/github.com/uptrace/bun/schema/dialect.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/uptrace/bun/schema/dialect.go')
-rw-r--r--vendor/github.com/uptrace/bun/schema/dialect.go13
1 files changed, 11 insertions, 2 deletions
diff --git a/vendor/github.com/uptrace/bun/schema/dialect.go b/vendor/github.com/uptrace/bun/schema/dialect.go
index b73d89bd0..fea8238dc 100644
--- a/vendor/github.com/uptrace/bun/schema/dialect.go
+++ b/vendor/github.com/uptrace/bun/schema/dialect.go
@@ -30,9 +30,14 @@ type Dialect interface {
AppendBytes(b []byte, bs []byte) []byte
AppendJSON(b, jsonb []byte) []byte
AppendBool(b []byte, v bool) []byte
+
+ // DefaultVarcharLen should be returned for dialects in which specifying VARCHAR length
+ // is mandatory in queries that modify the schema (CREATE TABLE / ADD COLUMN, etc).
+ // Dialects that do not have such requirement may return 0, which should be interpreted so by the caller.
+ DefaultVarcharLen() int
}
-//------------------------------------------------------------------------------
+// ------------------------------------------------------------------------------
type BaseDialect struct{}
@@ -131,7 +136,7 @@ func (BaseDialect) AppendBool(b []byte, v bool) []byte {
return dialect.AppendBool(b, v)
}
-//------------------------------------------------------------------------------
+// ------------------------------------------------------------------------------
type nopDialect struct {
BaseDialect
@@ -168,3 +173,7 @@ func (d *nopDialect) OnTable(table *Table) {}
func (d *nopDialect) IdentQuote() byte {
return '"'
}
+
+func (d *nopDialect) DefaultVarcharLen() int {
+ return 0
+}