todo.go 856 字节
package domain

import (
	"context"
	"gitlab.fjmaimaimai.com/allied-creation/sumifcc/pkg/transaction"
)

type Todo struct {
	Id        int64 // 唯一标识
	CreatedAt int64
	UpdatedAt int64
	DeletedAt int64
	Version   int
}

type TodoRepository interface {
	Insert(ctx context.Context, conn transaction.Conn, dm *Todo) (*Todo, error)
	Update(ctx context.Context, conn transaction.Conn, dm *Todo) (*Todo, error)
	UpdateWithVersion(ctx context.Context, conn transaction.Conn, dm *Todo) (*Todo, error)
	Delete(ctx context.Context, conn transaction.Conn, dm *Todo) (*Todo, error)
	FindOne(ctx context.Context, conn transaction.Conn, id int64) (*Todo, error)
	Find(ctx context.Context, conn transaction.Conn, queryOptions map[string]interface{}) (int64, []*Todo, error)
}

func (m *Todo) Identify() interface{} {
	if m.Id == 0 {
		return nil
	}
	return m.Id
}