commit

package
v1.1.0-beta Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 2, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Commit

type Commit[H any] struct {
	Id       int64     `gorm:"column:id;type:BIGINT(20);AUTO_INCREMENT;NOT NULL;comment:id;primary_key;comment:主键ID;"`
	UUID     string    `gorm:"size:36;not null;column:uuid;comment:uuid;uniqueIndex:uuid;"`
	Target   string    `gorm:"column:target;type:varchar(36);NOT NULL;comment:目标id;index:target;"`
	Key      string    `gorm:"size:36;not null;column:key;comment:类型;index:key;"`
	Data     *H        `gorm:"type:text;not null;column:data;comment:数据;charset=utf8mb4;serializer:json"`
	CreateAt time.Time `gorm:"type:timestamp;NOT NULL;DEFAULT:CURRENT_TIMESTAMP;column:create_at;comment:创建时间"`
	Operator string    `gorm:"size:36;not null;column:operator;comment:操作人;index:operator;"`
}

type ICommitStore

type ICommitStore[H any] interface {
	Save(ctx context.Context, key string, target string, h *H) error
	Latest(ctx context.Context, key string, target ...string) ([]*Commit[H], error)
	Get(ctx context.Context, uuid string) (*Commit[H], error)
	List(ctx context.Context, uuids ...string) ([]*Commit[H], error)
}

type ICommitWKStore

type ICommitWKStore[H any] interface {
	Save(ctx context.Context, target string, h *H) error
	Latest(ctx context.Context, target ...string) ([]*Commit[H], error)
	Get(ctx context.Context, uuid string) (*Commit[H], error)
	List(ctx context.Context, uuids ...string) ([]*Commit[H], error)
}

type Latest

type Latest struct {
	Id     int64  `gorm:"column:id;type:BIGINT(20);AUTO_INCREMENT;NOT NULL;comment:id;primary_key;comment:主键ID;"`
	Target string `gorm:"column:target;type:varchar(36);NOT NULL;comment:目标id;index:target;uniqueIndex:target_type;"`
	Key    string `gorm:"size:36;not null;column:key;comment:类型;index:key;uniqueIndex:target_type;"`
	Latest string `gorm:"size:36;not null;column:latest;comment:最新版本 id"`
}

type Store

type Store[H any] struct {
	// contains filtered or unexported fields
}

func NewCommitStore

func NewCommitStore[H any](name string) *Store[H]

func (*Store[H]) Get

func (h *Store[H]) Get(ctx context.Context, uuid string) (*Commit[H], error)

func (*Store[H]) Latest

func (h *Store[H]) Latest(ctx context.Context, key string, target ...string) ([]*Commit[H], error)

func (*Store[H]) List

func (h *Store[H]) List(ctx context.Context, uuids ...string) ([]*Commit[H], error)

func (*Store[H]) OnComplete

func (h *Store[H]) OnComplete()

func (*Store[H]) Save

func (h *Store[H]) Save(ctx context.Context, key string, target string, commit *H) error

type StoreWidthType

type StoreWidthType[H any] struct {
	Store[H]
	// contains filtered or unexported fields
}

func NewCommitWithKey

func NewCommitWithKey[H any](name, key string) *StoreWidthType[H]

func (*StoreWidthType[H]) Get

func (h *StoreWidthType[H]) Get(ctx context.Context, uuid string) (*Commit[H], error)

func (*StoreWidthType[H]) Latest

func (h *StoreWidthType[H]) Latest(ctx context.Context, target ...string) ([]*Commit[H], error)

func (*StoreWidthType[H]) List

func (h *StoreWidthType[H]) List(ctx context.Context, uuids ...string) ([]*Commit[H], error)

func (*StoreWidthType[H]) Save

func (h *StoreWidthType[H]) Save(ctx context.Context, target string, commit *H) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL