repository

package
v0.0.0-...-0948bf3 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertAggBase

func ConvertAggBase[I ID, P AggBaseSetter[I]](a dgo.AggBase, p P, parseID ParseID[I]) (P, error)

ConvertAggBase 从DomainObject转为PersistenceObject

func ConvertEvent

func ConvertEvent[I ID, E Event[I]](de *dgo.Event, newEvent func() E, newVid NewVid[I]) (E, error)

func ReverseAggBase

func ReverseAggBase[I ID](p AggBaseGetter[I]) dgo.AggBase

ReverseAggBase 从PersistenceObject转为DomainObject

Types

type AggBaseGetter

type AggBaseGetter[T ID] interface {
	GetID() T
	GetCreatedAt() time.Time
	GetUpdatedAt() time.Time
	GetVersion() uint64
}

type AggBaseSetter

type AggBaseSetter[I ID] interface {
	SetID(id I)
	SetCreatedAt(t time.Time)
	SetUpdatedAt(t time.Time)
	SetVersion(version uint64)
}

type Aggregate

type Aggregate[I ID] interface {
	AggBaseGetter[I]
	AggBaseSetter[I]
}

Aggregate 仓储层聚合接口,任何仓储实现必须实现此接口

type Event

type Event[I ID] interface {
	GetID() Vid[I]
	SetID(vid Vid[I])
	GetName() string
	SetName(eventName string)
	GetCreatedAt() time.Time
	SetCreatedAt(t time.Time)
	GetUUID() string
	SetUUID(uuid string)
	GetPayload() []byte
	SetPayload(payload []byte)
}

type ID

type ID interface {
	Reverse() dgo.ID
}

type NewVid

type NewVid[I ID] func(id dgo.ID, version uint64) (Vid[I], error)

type ObjectID

type ObjectID primitive.ObjectID

ObjectID mongodb默认ID

func NewObjectID

func NewObjectID() ObjectID

func ParseObjectID

func ParseObjectID(id dgo.ID) (o ObjectID, err error)

func (ObjectID) MarshalBSONValue

func (id ObjectID) MarshalBSONValue() (bsontype.Type, []byte, error)

func (ObjectID) Reverse

func (o ObjectID) Reverse() dgo.ID

func (*ObjectID) UnmarshalBSONValue

func (id *ObjectID) UnmarshalBSONValue(bt bsontype.Type, data []byte) error

type ParseID

type ParseID[I ID] func(id dgo.ID) (I, error)

type String

type String string

String 字符串ID

func ParseStringID

func ParseStringID(id dgo.ID) (String, error)

func (String) Reverse

func (s String) Reverse() dgo.ID

type U64

type U64 uint64

U64 uint64 ID

func ParseU64

func ParseU64(id dgo.ID) (U64, error)

func (U64) Reverse

func (u U64) Reverse() dgo.ID

type Vid

type Vid[I ID] interface {
	GetID() I
	SetID(id I)
	GetVersion() uint64
	SetVersion(version uint64)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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