role.go
1.2 KB
package domain
import (
"context"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/db/transaction"
)
type Role struct {
Id int64 `json:"id"` // 角色ID
Name string `json:"name"` // 角色名称
Auths []int64 `json:"auths"` // 角色权限列表
Remark string `json:"remark"` // 备注
Users []int64 `json:"users"` // 绑定的用户
CreatedAt int64 `json:"createdAt,omitempty"`
UpdatedAt int64 `json:"updatedAt,omitempty"`
DeletedAt int64 `json:"deletedAt,omitempty"`
Version int `json:"version,omitempty"`
}
type RoleRepository interface {
Insert(ctx context.Context, conn transaction.Conn, dm *Role) (*Role, error)
Update(ctx context.Context, conn transaction.Conn, dm *Role) (*Role, error)
UpdateWithVersion(ctx context.Context, conn transaction.Conn, dm *Role) (*Role, error)
Delete(ctx context.Context, conn transaction.Conn, dm *Role) (*Role, error)
FindOne(ctx context.Context, conn transaction.Conn, id int64) (*Role, error)
Find(ctx context.Context, conn transaction.Conn, queryOptions map[string]interface{}) (int64, []*Role, error)
}
func (m *Role) Identify() interface{} {
if m.Id == 0 {
return nil
}
return m.Id
}