upgrade: update wrapper

This commit is contained in:
2025-10-13 17:17:11 +08:00
parent cb3d32c360
commit 8db7966187
4 changed files with 24 additions and 16 deletions

View File

@ -11,7 +11,7 @@ import (
"fmt"
"git.zhangdeman.cn/zhangdeman/database/install/define"
"git.zhangdeman.cn/zhangdeman/wrapper"
"git.zhangdeman.cn/zhangdeman/wrapper/op_string"
)
var (
@ -42,7 +42,7 @@ func (h *helper) NewPrimaryID(name string, comment string) *define.Field {
Type: "BIGINT(20)",
Unsigned: true,
NotNull: true,
DefaultValue: wrapper.String("0").ToStringPtr().Value,
DefaultValue: op_string.ToBaseValuePtr[string]("0").Value,
PrimaryKey: true,
IsAutoIncrement: true,
Comment: comment,
@ -60,7 +60,7 @@ func (h *helper) NewBigintField(name string, unsigned bool, defaultVal string, c
Type: "BIGINT(20)",
Unsigned: unsigned,
NotNull: true,
DefaultValue: wrapper.String(defaultVal).ToStringPtr().Value,
DefaultValue: op_string.ToBaseValuePtr[string](defaultVal).Value,
PrimaryKey: false,
IsAutoIncrement: false,
Comment: comment,
@ -78,7 +78,7 @@ func (h *helper) NewIntField(name string, unsigned bool, defaultVal string, comm
Type: "INT(11)",
Unsigned: unsigned,
NotNull: true,
DefaultValue: wrapper.String(defaultVal).ToStringPtr().Value,
DefaultValue: op_string.ToBaseValuePtr[string](defaultVal).Value,
PrimaryKey: false,
IsAutoIncrement: false,
Comment: comment,
@ -96,7 +96,7 @@ func (h *helper) NewVarcharField(name string, length int, defaultVal string, com
Type: fmt.Sprintf("VARCHAR(%v)", length),
Unsigned: false,
NotNull: true,
DefaultValue: wrapper.String(defaultVal).ToStringPtr().Value,
DefaultValue: op_string.ToBaseValuePtr[string](defaultVal).Value,
PrimaryKey: false,
IsAutoIncrement: false,
Comment: comment,
@ -114,7 +114,7 @@ func (h *helper) NewCharField(name string, length int, comment string, defaultVa
Type: fmt.Sprintf("CHAR(%v)", length),
Unsigned: false,
NotNull: true,
DefaultValue: wrapper.String(defaultVal).ToStringPtr().Value,
DefaultValue: op_string.ToBaseValuePtr[string](defaultVal).Value,
PrimaryKey: false,
IsAutoIncrement: false,
Comment: comment,
@ -150,7 +150,7 @@ func (h *helper) NewTimestampField(name string, comment string, defaultVal strin
Type: "TIMESTAMP",
Unsigned: false,
NotNull: true,
DefaultValue: wrapper.String(defaultVal).ToStringPtr().Value,
DefaultValue: op_string.ToBaseValuePtr[string](defaultVal).Value,
PrimaryKey: false,
IsAutoIncrement: false,
Comment: comment,
@ -168,7 +168,7 @@ func (h *helper) NewTimestampFieldWithUpdate(name string, comment string, defaul
Type: "TIMESTAMP",
Unsigned: false,
NotNull: true,
DefaultValue: wrapper.String(defaultVal).ToStringPtr().Value,
DefaultValue: op_string.ToBaseValuePtr[string](defaultVal).Value,
PrimaryKey: false,
IsAutoIncrement: false,
OnUpdate: "current_timestamp()",