summaryrefslogtreecommitdiff
path: root/vendor/github.com/uptrace/bun/schema/append_value.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/uptrace/bun/schema/append_value.go')
-rw-r--r--vendor/github.com/uptrace/bun/schema/append_value.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/vendor/github.com/uptrace/bun/schema/append_value.go b/vendor/github.com/uptrace/bun/schema/append_value.go
index 948ff86af..8fe8a13b2 100644
--- a/vendor/github.com/uptrace/bun/schema/append_value.go
+++ b/vendor/github.com/uptrace/bun/schema/append_value.go
@@ -6,9 +6,11 @@ import (
"net"
"reflect"
"strconv"
+ "strings"
"time"
"github.com/uptrace/bun/dialect"
+ "github.com/uptrace/bun/dialect/sqltype"
"github.com/uptrace/bun/extra/bunjson"
"github.com/uptrace/bun/internal"
)
@@ -47,6 +49,19 @@ var appenders = []AppenderFunc{
reflect.UnsafePointer: nil,
}
+func FieldAppender(dialect Dialect, field *Field) AppenderFunc {
+ if field.Tag.HasOption("msgpack") {
+ return appendMsgpack
+ }
+
+ switch strings.ToUpper(field.UserSQLType) {
+ case sqltype.JSON, sqltype.JSONB:
+ return AppendJSONValue
+ }
+
+ return dialect.Appender(field.StructField.Type)
+}
+
func Appender(typ reflect.Type, custom CustomAppender) AppenderFunc {
switch typ {
case bytesType: