comment.go
1003 字节
package domain
import (
"context"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/db/transaction"
)
type Comment struct {
Id int64 // 唯一标识
CreatedAt int64 `json:",omitempty"`
UpdatedAt int64 `json:",omitempty"`
DeletedAt int64 `json:",omitempty"`
Version int `json:",omitempty"`
}
type CommentRepository interface {
Insert(ctx context.Context, conn transaction.Conn, dm *Comment) (*Comment, error)
Update(ctx context.Context, conn transaction.Conn, dm *Comment) (*Comment, error)
UpdateWithVersion(ctx context.Context, conn transaction.Conn, dm *Comment) (*Comment, error)
Delete(ctx context.Context, conn transaction.Conn, dm *Comment) (*Comment, error)
FindOne(ctx context.Context, conn transaction.Conn, id int64) (*Comment, error)
Find(ctx context.Context, conn transaction.Conn, queryOptions map[string]interface{}) (int64, []*Comment, error)
}
func (m *Comment) Identify() interface{} {
if m.Id == 0 {
return nil
}
return m.Id
}