baseentitee

package
v0.1.103 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CreatedAt

type CreatedAt time.Time

CreatedAt represents the creation timestamp of an entity.

func CreatedAtFromTime

func CreatedAtFromTime(t time.Time) CreatedAt

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

type DeletedAt time.Time

DeletedAt represents the deletion timestamp of an entity.

func DeletedAtFromTime

func DeletedAtFromTime(t *time.Time) *DeletedAt

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

type EntityId uuid.UUID

EntityId represents the unique identifier for an entity.

func EntityIdFromUUID

func EntityIdFromUUID(u uuid.UUID) EntityId

EntityIdFromUUID creates an EntityId from a given uuid.UUID.

func NewEntityId

func NewEntityId() EntityId

NewEntityId generates a new unique EntityId.

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

type UpdatedAt time.Time

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

func UpdatedAtFromTime(t time.Time) UpdatedAt

UpdatedAtFromTime creates a UpdatedAt from a given time.Time.

Jump to

Keyboard shortcuts

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