Documentation
¶
Index ¶
- Variables
- func SetIDGenerator(fn func() ID)
- type AggregateRoot
- type Entity
- type ID
- func (id ID) Equals(other ID) bool
- func (id ID) IsEmpty() bool
- func (id ID) MarshalBinary() (data []byte, err error)
- func (id ID) MarshalJSON() ([]byte, error)
- func (id ID) MarshalText() (text []byte, err error)
- func (id ID) String() string
- func (id *ID) UnmarshalBinary(data []byte) error
- func (id *ID) UnmarshalJSON(bytes []byte) error
- func (id *ID) UnmarshalText(text []byte) error
- type IDs
Constants ¶
This section is empty.
Variables ¶
var ULIDGenerator = func() ID { return ID(ulid.MustNew(ulid.Timestamp(time.Now()), rand.Reader).String()) }
ULIDGenerator is the default ID generator function that uses ULID algorithm.
var UUIDGenerator = func() ID { return ID(uuid.New().String()) }
UUIDGenerator is an ID generator function that uses UUID algorithm.
Functions ¶
func SetIDGenerator ¶
func SetIDGenerator(fn func() ID)
SetIDGenerator sets the ID generator function. Call this function before using any of the ID generating functions, preferably in an init() function.
By default, the ULID algorithm is used.
Types ¶
type AggregateRoot ¶
AggregateRoot is the base interface for all domain aggregate roots.
type Entity ¶
type Entity interface {
ID() ID
}
Entity is the base interface for all domain entities.
type ID ¶
type ID string
ID defines a globally unique identifier for an Entity.
func (ID) MarshalBinary ¶
MarshalBinary encodes this ID as binary.
func (ID) MarshalJSON ¶
MarshalJSON encodes this ID as JSON.
func (ID) MarshalText ¶
MarshalText marshals into a textual form.
func (*ID) UnmarshalBinary ¶
UnmarshalBinary decodes this ID back from binary.
func (*ID) UnmarshalJSON ¶
UnmarshalJSON decodes this ID back from JSON.
func (*ID) UnmarshalText ¶
UnmarshalText unmarshal a textual representation of an ID.
Directories
¶
Path | Synopsis |
---|---|
dispatcher
Package dispatcher provides a simple mechanism for dispatching domain events locally using a simple in-memory broker.
|
Package dispatcher provides a simple mechanism for dispatching domain events locally using a simple in-memory broker. |
drain
Package drain implements a composable message distribution package for Go.
|
Package drain implements a composable message distribution package for Go. |
examples
|
|
ordersapp
Package main provides a simple application example that uses the different "go-domain" package definitions.
|
Package main provides a simple application example that uses the different "go-domain" package definitions. |
Package pagination provides generic definitions for implementing `Timestamp_ID` Continuation Token pagination algorithm.
|
Package pagination provides generic definitions for implementing `Timestamp_ID` Continuation Token pagination algorithm. |