domain

package
v0.0.0-...-70b330c Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2022 License: Apache-2.0 Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Entity

type Entity interface {
	// TableName returns the table/collection name for a certain entity.
	TableName() string
	// SingularName returns the entity's name in singular.
	SingularName() string
	// PluralName returns the entity's name in plural.
	PluralName() string
}

Entity represents a generic entity. Entities represent models to be used with a certain Repository.

type Filter

type Filter interface {
	// Template represents a SQL Syntax.
	// Example: `name = ? AND age = ?`
	Template() string
	// Values returns the values used by the SQL Syntax.
	// Example: `["Test", 33]`
	Values() []interface{}
}

Filter represents a generic filter used by repositories to filter data by a key-value set.

type Repository

type Repository interface {
	Create([]Entity) ([]Entity, error)
	Find(output interface{}, offset, limit *int, filters ...Filter) error
	FindOne(entity Entity, filters ...Filter) error
	Update(data interface{}, filters ...Filter) error
	Delete(filters ...Filter) error
	SingularName() string
	PluralName() string
	Model() Entity
}

Repository represents a generic repository layer interface.

Jump to

Keyboard shortcuts

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