Documentation
¶
Index ¶
- type CreatedAt
- type DeletedAt
- type DeletedFlag
- type EntityId
- type EntityMetadata
- func (m EntityMetadata) GetCreatedAt() CreatedAt
- func (m EntityMetadata) GetCreatedAtTime() time.Time
- func (m EntityMetadata) GetDeletedAt() *DeletedAt
- func (m EntityMetadata) GetDeletedAtTime() *time.Time
- func (m EntityMetadata) GetDeletedFlag() DeletedFlag
- func (e *EntityMetadata) GetDomainEventsAndClear() []any
- func (m EntityMetadata) GetId() EntityId
- func (m EntityMetadata) GetIdString() string
- func (m EntityMetadata) GetIdUUID() uuid.UUID
- func (m EntityMetadata) GetUpdatedAt() UpdatedAt
- func (m EntityMetadata) GetUpdatedAtTime() time.Time
- func (m EntityMetadata) IsDeleted() bool
- func (m *EntityMetadata) MarkDeleted()
- func (m *EntityMetadata) MarkUpdated()
- func (e *EntityMetadata) RaiseDomainEvent(event any)
- type UpdatedAt
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CreatedAt ¶
CreatedAt represents the creation timestamp of an entity.
func CreatedAtFromTime ¶
CreatedAtFromTime creates a CreatedAt from a given time.Time.
func NewCreatedAt ¶
func NewCreatedAt() CreatedAt
NewCreatedAt creates a new CreatedAt with the current time.
type DeletedAt ¶
DeletedAt represents the deletion timestamp of an entity.
func DeletedAtFromTime ¶
DeletedAtFromTime creates a DeletedAt from a given *time.Time.
func NewDeletedAt ¶
func NewDeletedAt() *DeletedAt
NewDeletedAt creates a new DeletedAt set to nil (not deleted).
type DeletedFlag ¶
type DeletedFlag bool
DeletedFlag represents whether an entity is deleted.
func DeletedFlagFromBool ¶
func DeletedFlagFromBool(b bool) DeletedFlag
DeletedFlagFromBool creates a DeletedFlag from a boolean value.
func NewDeletedFlag ¶
func NewDeletedFlag() DeletedFlag
NewDeletedFlag creates a new DeletedFlag set to false.
type EntityId ¶
EntityId represents the unique identifier for an entity.
func EntityIdFromUUID ¶
EntityIdFromUUID creates an EntityId from a given uuid.UUID.
type EntityMetadata ¶
type EntityMetadata struct {
// contains filtered or unexported fields
}
EntityMetadata represents the baseentitee metadata object for an entity.
func MapToEntityMetadata ¶
func MapToEntityMetadata( id EntityId, createdAt CreatedAt, updatedAt UpdatedAt, deleted DeletedFlag, deletedAt *DeletedAt, ) *EntityMetadata
MapToEntityMetadata maps the baseentitee metadata types to EntityMetadata.
func MapToEntityMetadataFromCommonTypes ¶
func MapToEntityMetadataFromCommonTypes( id uuid.UUID, createdAt time.Time, updatedAt time.Time, deleted bool, deletedAt *time.Time, ) *EntityMetadata
MapToEntityMetadataFromCommonTypes maps common Go types to EntityMetadata.
func NewEntityMetadata ¶
func NewEntityMetadata() *EntityMetadata
NewEntityMetadata creates a new EntityMetadata with default values.
func (EntityMetadata) GetCreatedAt ¶
func (m EntityMetadata) GetCreatedAt() CreatedAt
GetCreatedAt returns the CreatedAt of the entity.
func (EntityMetadata) GetCreatedAtTime ¶
func (m EntityMetadata) GetCreatedAtTime() time.Time
GetCreatedAtTime returns the time.Time value of CreatedAt.
func (EntityMetadata) GetDeletedAt ¶
func (m EntityMetadata) GetDeletedAt() *DeletedAt
GetDeletedAt returns the DeletedAt of the entity.
func (EntityMetadata) GetDeletedAtTime ¶
func (m EntityMetadata) GetDeletedAtTime() *time.Time
GetDeletedAtTime returns the time.Time value of DeletedAt, or nil if not set.
func (EntityMetadata) GetDeletedFlag ¶
func (m EntityMetadata) GetDeletedFlag() DeletedFlag
GetDeletedFlag returns the DeletedFlag of the entity.
func (*EntityMetadata) GetDomainEventsAndClear ¶ added in v0.0.43
func (e *EntityMetadata) GetDomainEventsAndClear() []any
GetDomainEventsAndClear retrieves and clears the domain events associated with the entity.
func (EntityMetadata) GetId ¶
func (m EntityMetadata) GetId() EntityId
GetId returns the EntityId of the entity.
func (EntityMetadata) GetIdString ¶
func (m EntityMetadata) GetIdString() string
GetIdString returns the string representation of the EntityId.
func (EntityMetadata) GetIdUUID ¶
func (m EntityMetadata) GetIdUUID() uuid.UUID
GetIdUUID returns the UUID of the entity.
func (EntityMetadata) GetUpdatedAt ¶
func (m EntityMetadata) GetUpdatedAt() UpdatedAt
GetUpdatedAt returns the UpdatedAt of the entity.
func (EntityMetadata) GetUpdatedAtTime ¶
func (m EntityMetadata) GetUpdatedAtTime() time.Time
GetUpdatedAtTime returns the time.Time value of UpdatedAt.
func (EntityMetadata) IsDeleted ¶
func (m EntityMetadata) IsDeleted() bool
IsDeleted returns true if the entity is marked as deleted.
func (*EntityMetadata) MarkDeleted ¶
func (m *EntityMetadata) MarkDeleted()
MarkDeleted marks the entity as deleted and sets the DeletedAt timestamp.
func (*EntityMetadata) MarkUpdated ¶
func (m *EntityMetadata) MarkUpdated()
MarkUpdated updates the UpdatedAt timestamp to the current time.
func (*EntityMetadata) RaiseDomainEvent ¶ added in v0.0.43
func (e *EntityMetadata) RaiseDomainEvent(event any)
raiseDomainEvent appends a new domain event to the entity's event list.
type UpdatedAt ¶
UpdatedAt represents the last updated timestamp of an entity.
func NewUpdatedAt ¶
func NewUpdatedAt() UpdatedAt
NewUpdatedAt creates a new UpdatedAt with the current time.
func UpdatedAtFromTime ¶
UpdatedAtFromTime creates a UpdatedAt from a given time.Time.