pubdomain

package
v1.15.0 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2023 License: AGPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// CreatedAt defines the name of the field/column/attribute of the record
	// that defines when the record was created or stored for the first time
	// in the data store
	CreatedAt = "created_at"
	// UpdatedAt defines the name of the field/column/attribute of the record
	// that defines when the record was updated for the last time
	// in the data store
	UpdatedAt = "updated_at"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Entity added in v1.14.0

type Entity struct {
	// contains filtered or unexported fields
}

Entity is a specific definition of an object/entity/thing inside a domain

func NewEntity added in v1.14.0

func NewEntity(
	id string,
	name string,
	singularName string,
	pluralName string,
	fields []field.Field,
	collection string,
) (*Entity, error)

NewEntity creates an instance of Entity

func (*Entity) Collection added in v1.14.0

func (e *Entity) Collection() string

Collection returns entity collection name

func (*Entity) Fields added in v1.14.0

func (e *Entity) Fields() []field.Field

Fields returns entity fields

func (*Entity) GetFieldByName added in v1.14.0

func (e *Entity) GetFieldByName(name string) field.Field

GetFieldByName returns a single field according to its name

func (*Entity) Id added in v1.14.0

func (e *Entity) Id() string

Id returns entity id

func (*Entity) IsZero added in v1.14.0

func (e *Entity) IsZero() bool

IsZero defines whether Entity is empty

func (*Entity) Name added in v1.14.0

func (e *Entity) Name() string

Name returns entity name

func (*Entity) PluralName added in v1.14.0

func (e *Entity) PluralName() string

PluralName returns entity plural name

func (*Entity) SingularName added in v1.14.0

func (e *Entity) SingularName() string

SingularName returns entity singular name

func (*Entity) String added in v1.14.0

func (e *Entity) String() string

String defines the string interface

type FieldError

type FieldError struct {
	// contains filtered or unexported fields
}

FieldError holds the error message for a specific field

func NewFieldError

func NewFieldError(field string, message string) (*FieldError, error)

NewFieldError creates a new instance of FieldError

func (*FieldError) Field

func (fe *FieldError) Field() string

Field returns the name of the field

func (*FieldError) IsZero

func (fe *FieldError) IsZero() bool

IsZero defines whether FieldError is empty

func (*FieldError) Message

func (fe *FieldError) Message() string

Message returns the error message related to the field

type Pager added in v1.11.0

type Pager struct {
	// contains filtered or unexported fields
}

Pager defines all the parameters needed to list records properly

func NewPager added in v1.11.0

func NewPager(
	page uint32,
	size uint32,
) (*Pager, error)

NewPager creates an instance of Pager

func (*Pager) IsZero added in v1.11.0

func (p *Pager) IsZero() bool

IsZero defines whether Pager is empty

func (*Pager) Page added in v1.11.0

func (p *Pager) Page() uint32

Page returns the number of the page

func (*Pager) Size added in v1.11.0

func (p *Pager) Size() uint32

Size returns the amount of records of the page

func (*Pager) String added in v1.11.0

func (p *Pager) String() string

String defines the string interface

type Record

type Record struct {
	// contains filtered or unexported fields
}

Record defines the data that holds the mapping between the name of the field and its value

func NewRecord

func NewRecord() *Record

NewRecord creates a new instance of Record

func (*Record) Data

func (rrd *Record) Data() recordData

Data returns all data of the record

func (*Record) GetValueByKey

func (rrd *Record) GetValueByKey(key string) interface{}

GetValueByKey returns the value of a specific key from the data

func (*Record) IsZero

func (rrd *Record) IsZero() bool

IsZero defines whether Record is empty

func (*Record) SetData

func (rrd *Record) SetData(data recordData)

SetData sets completely the data attribute Be careful using this method since it can modify original data

type RecordValidationErrors

type RecordValidationErrors struct {
	// contains filtered or unexported fields
}

RecordValidationErrors holds all the errors that were generated for validation of every field related to an entity

func NewRecordValidationErrors

func NewRecordValidationErrors() *RecordValidationErrors

NewRecordValidationErrors creates a new instance of RecordValidationErrors

func (*RecordValidationErrors) AddError

func (rve *RecordValidationErrors) AddError(fieldError *FieldError)

AddError adds a single error to the error list. A single error means that it adds the error message related to a field

func (*RecordValidationErrors) Error

func (rve *RecordValidationErrors) Error() string

Error returns a strigified version of all the errors. This method follows the default golang error interface

func (*RecordValidationErrors) Errors

func (rve *RecordValidationErrors) Errors() []*FieldError

Errors returns the list of errors

func (*RecordValidationErrors) IsZero

func (rve *RecordValidationErrors) IsZero() bool

IsZero defines whether RecordValidationErrors is empty

Directories

Path Synopsis
mocks
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.
rule/mocks
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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