切换导航条
此项目
正在载入...
登录
mmm-go
/
partnermg
·
提交
转到一个项目
GitLab
转到群组
项目
活动
文件
提交
管道
0
构建
0
图表
里程碑
问题
0
合并请求
0
成员
标记
维基
派生
网络
创建新的问题
下载为
邮件补丁
差异文件
浏览文件
作者
唐旭辉
5 years ago
提交
633716099913b92996bd5305c018f8b62d09113f
1 个父辈
b27fe841
数据同步修正
隐藏空白字符变更
内嵌
并排对比
正在显示
2 个修改的文件
包含
38 行增加
和
1 行删除
pkg/infrastructure/pg/models/company.go
pkg/infrastructure/pg/models/users.go
pkg/infrastructure/pg/models/company.go
查看文件 @
6337160
package
models
import
"time"
import
(
"context"
"time"
"github.com/go-pg/pg/v10"
)
// 公司信息
type
Company
struct
{
...
...
@@ -30,3 +35,18 @@ type Company struct {
// 删除时间
DeleteAt
time
.
Time
}
var
_
pg
.
BeforeUpdateHook
=
(
*
Company
)(
nil
)
func
(
c
*
Company
)
BeforeUpdate
(
ctx
context
.
Context
)
(
context
.
Context
,
error
)
{
c
.
UpdateAt
=
time
.
Now
()
return
ctx
,
nil
}
var
_
pg
.
BeforeInsertHook
=
(
*
Company
)(
nil
)
func
(
c
*
Company
)
BeforeInsert
(
ctx
context
.
Context
)
(
context
.
Context
,
error
)
{
c
.
CreateAt
=
time
.
Now
()
c
.
UpdateAt
=
time
.
Now
()
return
ctx
,
nil
}
...
...
pkg/infrastructure/pg/models/users.go
查看文件 @
6337160
package
models
import
(
"context"
"time"
"github.com/go-pg/pg/v10"
"gitlab.fjmaimaimai.com/mmm-go/partnermg/pkg/domain"
)
...
...
@@ -31,3 +33,18 @@ type Users struct {
UpdateAt
time
.
Time
DeleteAt
time
.
Time
}
var
_
pg
.
BeforeUpdateHook
=
(
*
Users
)(
nil
)
func
(
user
*
Users
)
BeforeUpdate
(
ctx
context
.
Context
)
(
context
.
Context
,
error
)
{
user
.
UpdateAt
=
time
.
Now
()
return
ctx
,
nil
}
var
_
pg
.
BeforeInsertHook
=
(
*
Users
)(
nil
)
func
(
user
*
Users
)
BeforeInsert
(
ctx
context
.
Context
)
(
context
.
Context
,
error
)
{
user
.
CreateAt
=
time
.
Now
()
user
.
UpdateAt
=
time
.
Now
()
return
ctx
,
nil
}
...
...
请
注册
或
登录
后发表评论