constraints

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2019 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ChapterMustExists

func ChapterMustExists(chapters repositories.Chapter, id string, entity *models.Chapter) func(ctx context.Context) error

ChapterMustExists specification checks if given chapter exists

func ChapterNameMustBeUnique

func ChapterNameMustBeUnique(chapters repositories.Chapter, name string) func(ctx context.Context) error

ChapterNameMustBeUnique returns specification for chapter name uniqueness

func GuildMustExists

func GuildMustExists(guilds repositories.Guild, id string, entity *models.Guild) func(ctx context.Context) error

GuildMustExists specification checks if given guild exists

func GuildNameMustBeUnique

func GuildNameMustBeUnique(guilds repositories.Guild, name string) func(ctx context.Context) error

GuildNameMustBeUnique returns specification for chapter name uniqueness

func MustBeAName

func MustBeAName(value string) func(context.Context) error

MustBeAName returns a ID contraint validator

func MustBeAnIdentifier

func MustBeAnIdentifier(value string) func(context.Context) error

MustBeAnIdentifier returns a ID contraint validator

func MustBeValid

func MustBeValid(validable Validable) func(context.Context) error

MustBeValid specification checks that given object is valid

func MustNotBeNil

func MustNotBeNil(object interface{}, message string) func(context.Context) error

MustNotBeNil specification checks that given object is not nil

func SquadMustExists

func SquadMustExists(squads repositories.Squad, id string, entity *models.Squad) func(ctx context.Context) error

SquadMustExists specification checks if given squad exists

func SquadNameMustBeUnique

func SquadNameMustBeUnique(squads repositories.Squad, name string) func(ctx context.Context) error

SquadNameMustBeUnique returns specification for squad name uniqueness

func TribeMustExists

func TribeMustExists(tribes repositories.Tribe, id string, entity *models.Tribe) func(ctx context.Context) error

TribeMustExists specification checks if given tribe exists

func TribeNameMustBeUnique

func TribeNameMustBeUnique(tribes repositories.Tribe, name string) func(ctx context.Context) error

TribeNameMustBeUnique returns specification for tribe name uniqueness

func UserMustExists

func UserMustExists(users repositories.User, id string, entity *models.User) func(ctx context.Context) error

UserMustExists specification checks if given user exists

func UserPrincipalMustBeUnique

func UserPrincipalMustBeUnique(users repositories.User, principal string) func(ctx context.Context) error

UserPrincipalMustBeUnique returns specification for user principal uniqueness

func Validate

func Validate(ctx context.Context, constraints ...Builder) error

Validate service constraints

Types

type Builder

type Builder func(context.Context) error

Builder defines matcher constraints

type EntityRetrieverFunc

type EntityRetrieverFunc func(context.Context) (interface{}, error)

EntityRetrieverFunc describes function indirection for repositories

type Validable

type Validable interface {
	Validate() error
}

Validable interface used to defines Validation protocol

Jump to

Keyboard shortcuts

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