base

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2020 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Component

type Component struct {
	Logger abstraction.Logger
	// contains filtered or unexported fields
}

Component provides a base functionality for multiple components

func NewHandlerComponent

func NewHandlerComponent(logger abstraction.Logger, presentationType string, handlerName string) *Component

NewHandlerComponent creates a new base component for a presentation handler

func NewRepositoryComponent

func NewRepositoryComponent(logger abstraction.Logger, storageType string, repositoryName string) *Component

NewRepositoryComponent creates a new base component for a repository

func NewServiceComponent

func NewServiceComponent(logger abstraction.Logger, serviceName string) *Component

NewServiceComponent creates a new base component for a service

func (*Component) Error

func (c *Component) Error(message string, err error) error

type Entity

type Entity struct {
	ID        uuid.UUID
	CreatedAt time.Time
	UpdatedAt time.Time
}

Entity provides common elements for all entities

func LoadEntity

func LoadEntity(id uuid.UUID, createdAt time.Time, updatedAt time.Time) *Entity

LoadEntity loads data into a new instance of base entity

func NewEntity

func NewEntity() *Entity

NewEntity creates a new instance of base entity

func (*Entity) GenerateNewID

func (e *Entity) GenerateNewID() error

GenerateNewID generate and assigns a new ID to the entity

func (*Entity) GetID

func (e *Entity) GetID() uuid.UUID

GetID obtains the ID of the Entity

func (*Entity) ResetID

func (e *Entity) ResetID()

ResetID generate and assigns a new ID to the entity

func (*Entity) Validate

func (e *Entity) Validate() error

Validate ensures the data in a Location is valid

type HasID

type HasID interface {
	GetID() uuid.UUID
}

HasID defines if an struct has ID

Jump to

Keyboard shortcuts

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