test

package
v0.0.0-...-faedae1 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var IncidentBuilder = IncidentBuilderFunc(func(opts ...func(*Incident) []string) partial.Partial[Incident] {
	apply := func(base Incident) partial.Partial[Incident] {
		model := partial.Partial[Incident]{
			Subject:    base,
			FieldNames: []string{},
		}
		for _, opt := range opts {
			model.FieldNames = append(model.FieldNames, opt(&model.Subject)...)
		}

		return model
	}

	model := apply(Incident{})
	model.SetApply(func(base Incident) *Incident {
		patched := apply(base).Subject
		return &patched
	})

	return model
})

IncidentBuilder initialises a Incident struct with fields from the given setters. Setters are applied first to last, with subsequent sets taking precedence.

View Source
var IncidentMatcher = IncidentMatcherFunc(func(opts ...func(*Incident, *gstruct.Fields)) types.GomegaMatcher {
	fields := gstruct.Fields{}
	for _, opt := range opts {
		opt(nil, &fields)
	}

	return gstruct.PointTo(
		gstruct.MatchFields(gstruct.IgnoreExtras, fields),
	)
})

IncidentMatcher creates a Gomega matcher for Incident against the given fields. Matchers are applied first to last, with subsequent matchers taking precedence.

View Source
var OrganisationBuilder = OrganisationBuilderFunc(func(opts ...func(*Organisation) []string) partial.Partial[Organisation] {
	apply := func(base Organisation) partial.Partial[Organisation] {
		model := partial.Partial[Organisation]{
			Subject:    base,
			FieldNames: []string{},
		}
		for _, opt := range opts {
			model.FieldNames = append(model.FieldNames, opt(&model.Subject)...)
		}

		return model
	}

	model := apply(Organisation{})
	model.SetApply(func(base Organisation) *Organisation {
		patched := apply(base).Subject
		return &patched
	})

	return model
})

OrganisationBuilder initialises a Organisation struct with fields from the given setters. Setters are applied first to last, with subsequent sets taking precedence.

View Source
var OrganisationMatcher = OrganisationMatcherFunc(func(opts ...func(*Organisation, *gstruct.Fields)) types.GomegaMatcher {
	fields := gstruct.Fields{}
	for _, opt := range opts {
		opt(nil, &fields)
	}

	return gstruct.PointTo(
		gstruct.MatchFields(gstruct.IgnoreExtras, fields),
	)
})

OrganisationMatcher creates a Gomega matcher for Organisation against the given fields. Matchers are applied first to last, with subsequent matchers taking precedence.

Functions

This section is empty.

Types

type Incident

type Incident struct {
	ID             string `json:"id" gorm:"type:text;primaryKey;default:generate_ulid()"`
	OrganisationID string `json:"organisation_id"`
	Organisation   *Organisation
	CreatedAt      time.Time `json:"created_at"`
}

codegen-partial:builder,matcher

func (Incident) Matcher

func (b Incident) Matcher(opts ...func(*Incident, *gstruct.Fields)) types.GomegaMatcher

Matcher is added to the base type, permitting other generic functions to build matchers from each of the matcher-setter functions.

type IncidentBuilderFunc

type IncidentBuilderFunc func(opts ...func(*Incident) []string) partial.Partial[Incident]

func (IncidentBuilderFunc) CreatedAt

func (b IncidentBuilderFunc) CreatedAt(value time.Time) func(*Incident) []string

func (IncidentBuilderFunc) ID

func (b IncidentBuilderFunc) ID(value string) func(*Incident) []string

func (IncidentBuilderFunc) Organisation

func (b IncidentBuilderFunc) Organisation(value *Organisation) func(*Incident) []string

func (IncidentBuilderFunc) OrganisationID

func (b IncidentBuilderFunc) OrganisationID(value string) func(*Incident) []string

type IncidentMatcherFunc

type IncidentMatcherFunc func(opts ...func(*Incident, *gstruct.Fields)) types.GomegaMatcher

func (IncidentMatcherFunc) CreatedAt

func (b IncidentMatcherFunc) CreatedAt(value time.Time) func(*Incident, *gstruct.Fields)

func (IncidentMatcherFunc) ID

func (b IncidentMatcherFunc) ID(value string) func(*Incident, *gstruct.Fields)

func (IncidentMatcherFunc) Match

Match returns an interface with the same methods as the base matcher, but accepting GomegaMatcher parameters instead of the exact equality matches.

func (IncidentMatcherFunc) MatchCreatedAt

func (b IncidentMatcherFunc) MatchCreatedAt(value types.GomegaMatcher) func(*Incident, *gstruct.Fields)

func (IncidentMatcherFunc) MatchID

func (b IncidentMatcherFunc) MatchID(value types.GomegaMatcher) func(*Incident, *gstruct.Fields)

func (IncidentMatcherFunc) MatchOrganisation

func (b IncidentMatcherFunc) MatchOrganisation(value types.GomegaMatcher) func(*Incident, *gstruct.Fields)

func (IncidentMatcherFunc) MatchOrganisationID

func (b IncidentMatcherFunc) MatchOrganisationID(value types.GomegaMatcher) func(*Incident, *gstruct.Fields)

func (IncidentMatcherFunc) Organisation

func (b IncidentMatcherFunc) Organisation(value *Organisation) func(*Incident, *gstruct.Fields)

func (IncidentMatcherFunc) OrganisationID

func (b IncidentMatcherFunc) OrganisationID(value string) func(*Incident, *gstruct.Fields)

type IncidentMatcherMatchers

type IncidentMatcherMatchers struct{}

func (IncidentMatcherMatchers) CreatedAt

func (b IncidentMatcherMatchers) CreatedAt(value types.GomegaMatcher) func(*Incident, *gstruct.Fields)

func (IncidentMatcherMatchers) ID

func (IncidentMatcherMatchers) Organisation

func (b IncidentMatcherMatchers) Organisation(value types.GomegaMatcher) func(*Incident, *gstruct.Fields)

func (IncidentMatcherMatchers) OrganisationID

func (b IncidentMatcherMatchers) OrganisationID(value types.GomegaMatcher) func(*Incident, *gstruct.Fields)

type Organisation

type Organisation struct {
	ID             string      `json:"id" gorm:"type:text;primaryKey;default:generate_ulid()"`
	Name           string      `json:"name"`
	OptionalString null.String `json:"optional_string"`
	BoolFlag       bool        `json:"bool_flag"`
}

codegen-partial:builder,matcher

func (Organisation) Matcher

func (b Organisation) Matcher(opts ...func(*Organisation, *gstruct.Fields)) types.GomegaMatcher

Matcher is added to the base type, permitting other generic functions to build matchers from each of the matcher-setter functions.

type OrganisationBuilderFunc

type OrganisationBuilderFunc func(opts ...func(*Organisation) []string) partial.Partial[Organisation]

func (OrganisationBuilderFunc) BoolFlag

func (b OrganisationBuilderFunc) BoolFlag(value bool) func(*Organisation) []string

func (OrganisationBuilderFunc) ID

func (b OrganisationBuilderFunc) ID(value string) func(*Organisation) []string

func (OrganisationBuilderFunc) Name

func (b OrganisationBuilderFunc) Name(value string) func(*Organisation) []string

func (OrganisationBuilderFunc) OptionalString

func (b OrganisationBuilderFunc) OptionalString(value null.String) func(*Organisation) []string

type OrganisationMatcherFunc

type OrganisationMatcherFunc func(opts ...func(*Organisation, *gstruct.Fields)) types.GomegaMatcher

func (OrganisationMatcherFunc) BoolFlag

func (b OrganisationMatcherFunc) BoolFlag(value bool) func(*Organisation, *gstruct.Fields)

func (OrganisationMatcherFunc) ID

func (OrganisationMatcherFunc) Match

Match returns an interface with the same methods as the base matcher, but accepting GomegaMatcher parameters instead of the exact equality matches.

func (OrganisationMatcherFunc) MatchBoolFlag

func (b OrganisationMatcherFunc) MatchBoolFlag(value types.GomegaMatcher) func(*Organisation, *gstruct.Fields)

func (OrganisationMatcherFunc) MatchID

func (OrganisationMatcherFunc) MatchName

func (OrganisationMatcherFunc) MatchOptionalString

func (b OrganisationMatcherFunc) MatchOptionalString(value types.GomegaMatcher) func(*Organisation, *gstruct.Fields)

func (OrganisationMatcherFunc) Name

func (b OrganisationMatcherFunc) Name(value string) func(*Organisation, *gstruct.Fields)

func (OrganisationMatcherFunc) OptionalString

func (b OrganisationMatcherFunc) OptionalString(value null.String) func(*Organisation, *gstruct.Fields)

type OrganisationMatcherMatchers

type OrganisationMatcherMatchers struct{}

func (OrganisationMatcherMatchers) BoolFlag

func (OrganisationMatcherMatchers) ID

func (OrganisationMatcherMatchers) Name

func (OrganisationMatcherMatchers) OptionalString

func (b OrganisationMatcherMatchers) OptionalString(value types.GomegaMatcher) func(*Organisation, *gstruct.Fields)

Jump to

Keyboard shortcuts

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