base

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2020 License: GPL-3.0 Imports: 6 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 NewServerComponent added in v0.3.0

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

NewServerComponent creates a new base component for a presentation server

func NewServiceComponent

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

NewServiceComponent creates a new base component for a service

func (*Component) NewError added in v0.3.0

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

NewError creates a new error instance with the provided information

type Entity

type Entity struct {
	ID        uuid.UUID
	CreatedAt time.Time `validate:"required"`
	UpdatedAt time.Time `validate:"required,gtefield=CreatedAt"`
}

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