generic

package
v2.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CFD

type CFD[RawEntity any, CastedEntity filter.Filterable, Create, List, Delete any] struct {
	CreateService[Create, RawEntity, CastedEntity]
	FilterService[List, RawEntity, CastedEntity]
	DeleteService[Delete]
}

CFD = Create - Filter - Delete

func NewCFD

func NewCFD[RawEntity any, CastedEntity filter.Filterable, Create, List, Delete any](
	service cfdService[RawEntity, Create, List, Delete],
	cast Cast[RawEntity, CastedEntity],
) CFD[RawEntity, CastedEntity, Create, List, Delete]

type CRD

type CRD[RawEntity any, CastedEntity filter.Filterable, Create, Get, List, Delete any] struct {
	CreateService[Create, RawEntity, CastedEntity]
	GetService[Get, RawEntity, CastedEntity]
	FilterService[List, RawEntity, CastedEntity]
	DeleteService[Delete]
}

CRD = Create - Read (Get & Filter) - Delete

func NewCRD

func NewCRD[RawEntity any, CastedEntity filter.Filterable, Create, Get, List, Delete any](
	service crdService[RawEntity, Create, Get, List, Delete],
	cast Cast[RawEntity, CastedEntity],
) CRD[RawEntity, CastedEntity, Create, Get, List, Delete]

type CRUD

type CRUD[RawEntity any, CastedEntity filter.Filterable, Create, Get, List, Update, Delete any] struct {
	CreateService[Create, RawEntity, CastedEntity]
	GetService[Get, RawEntity, CastedEntity]
	FilterService[List, RawEntity, CastedEntity]
	UpdateService[Update, RawEntity, CastedEntity]
	DeleteService[Delete]
}

CRUD = Create - Read (Get & Filter) - Update - Delete

func NewCRUD

func NewCRUD[RawEntity any, CastedEntity filter.Filterable, Create, Get, List, Update, Delete any](
	service crudService[RawEntity, Create, Get, List, Update, Delete],
	cast Cast[RawEntity, CastedEntity],
) CRUD[RawEntity, CastedEntity, Create, Get, List, Update, Delete]

type Cast

type Cast[Original, Casted any] func(Original) Casted

type CreateService

type CreateService[Input, RawOutput, CastedOutput any] struct {
	// contains filtered or unexported fields
}

func NewCreate

func NewCreate[Input, RawOutput, CastedOutput any](
	service createService[Input, RawOutput],
	cast Cast[RawOutput, CastedOutput],
) CreateService[Input, RawOutput, CastedOutput]

func (CreateService[Input, RawOutput, CastedOutput]) Create

func (c CreateService[Input, RawOutput, CastedOutput]) Create(ctx context.Context, in Input) (CastedOutput, error)

type DeleteService

type DeleteService[Input any] struct {
	// contains filtered or unexported fields
}

func NewDelete

func NewDelete[Input any](
	service deleteService[Input],
) DeleteService[Input]

func (DeleteService[Input]) Delete

func (d DeleteService[Input]) Delete(ctx context.Context, in Input) error

type FilterService

type FilterService[Input, RawOutput any, CastedOutput filter.Filterable] struct {
	ListService[Input, RawOutput, CastedOutput]
}

func NewFilter

func NewFilter[Input, RawOutput any, CastedOutput filter.Filterable](
	service listService[Input, RawOutput],
	cast Cast[RawOutput, CastedOutput],
) FilterService[Input, RawOutput, CastedOutput]

func (FilterService[Input, RawOutput, CastedOutput]) Filter

func (f FilterService[Input, RawOutput, CastedOutput]) Filter(
	ctx context.Context,
	in Input,
	appliedFilter string,
) ([]CastedOutput, error)

func (FilterService[Input, RawOutput, CastedOutput]) FindOne

func (f FilterService[Input, RawOutput, CastedOutput]) FindOne(
	ctx context.Context,
	in Input,
	appliedFilter string,
) (c CastedOutput, r error)

type GetService

type GetService[Input, RawOutput, CastedOutput any] struct {
	// contains filtered or unexported fields
}

func NewGet

func NewGet[Input, RawOutput, CastedOutput any](
	service getService[Input, RawOutput],
	cast Cast[RawOutput, CastedOutput],
) GetService[Input, RawOutput, CastedOutput]

func (GetService[Input, RawOutput, CastedOutput]) Get

func (g GetService[Input, RawOutput, CastedOutput]) Get(ctx context.Context, in Input) (c CastedOutput, r error)

type ListService

type ListService[Input, RawOutput, CastedOutput any] struct {
	// contains filtered or unexported fields
}

func NewList

func NewList[Input, RawOutput, CastedOutput any](
	service listService[Input, RawOutput],
	cast Cast[RawOutput, CastedOutput],
) ListService[Input, RawOutput, CastedOutput]

func (ListService[Input, RawOutput, CastedOutput]) List

func (l ListService[Input, RawOutput, CastedOutput]) List(ctx context.Context, in Input) ([]CastedOutput, error)

type OrderedCreateService

type OrderedCreateService[Input any] struct {
	// contains filtered or unexported fields
}

func NewOrderedCreate

func NewOrderedCreate[Input any](
	service orderedCreateService[Input],
) OrderedCreateService[Input]

func (OrderedCreateService[Input]) Create

func (c OrderedCreateService[Input]) Create(ctx context.Context, in Input) (common.Ordering, error)

type PerformActionService

type PerformActionService[ActionInput, RawOutput, CastedOutput any] struct {
	// contains filtered or unexported fields
}

func NewPerformAction

func NewPerformAction[Input, RawOutput, CastedOutput any](
	service performActionService[Input, RawOutput],
	cast Cast[RawOutput, CastedOutput],
) PerformActionService[Input, RawOutput, CastedOutput]

func (PerformActionService[ActionInput, RawOutput, CastedOutput]) Perform

func (p PerformActionService[ActionInput, RawOutput, CastedOutput]) Perform(
	ctx context.Context,
	in ActionInput,
) (c CastedOutput, r error)

type Read

type Read[RawEntity any, CastedEntity filter.Filterable, Get, List any] struct {
	GetService[Get, RawEntity, CastedEntity]
	FilterService[List, RawEntity, CastedEntity]
}

Read (Get & Filter)

func NewRead

func NewRead[RawEntity any, CastedEntity filter.Filterable, Get, List any](
	service readService[RawEntity, Get, List],
	cast Cast[RawEntity, CastedEntity],
) Read[RawEntity, CastedEntity, Get, List]

type UpdateService

type UpdateService[Input, RawOutput, CastedOutput any] struct {
	// contains filtered or unexported fields
}

func NewUpdate

func NewUpdate[Input, RawOutput, CastedOutput any](
	service updateService[Input, RawOutput],
	cast Cast[RawOutput, CastedOutput],
) UpdateService[Input, RawOutput, CastedOutput]

func (UpdateService[Input, RawOutput, CastedOutput]) Update

func (u UpdateService[Input, RawOutput, CastedOutput]) Update(ctx context.Context, in Input) (c CastedOutput, r error)

Jump to

Keyboard shortcuts

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