client

package
v1.0.6 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2025 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DecoderFn

type DecoderFn[T any] func(dto api.UntypedDto) (*T, error)

type EncoderFn

type EncoderFn[T any] func(*T) (api.UntypedDto, error)

type GenericInterface

type GenericInterface[T any] interface {
	List(context.Context, query.Interface) ([]*T, int, error)
	Create(context.Context, *T) (*T, error)
	Get(context.Context, string) (*T, error)
	Delete(context.Context, string) error
	Update(context.Context, string, *T) (*T, error)
	BulkUpdate(context.Context, []*T, api.BulkUpdateMode) error
}

func New

func New[T any](endpoint, backend, entity string, opts ...Opt[T]) (GenericInterface[T], error)

type Opt

type Opt[T any] func(*generic[T])

func SkipProperties

func SkipProperties[T any](props []string) Opt[T]

SkipProperties sets properties that will not be sent to REST API during create/update operations

func WithClientOptions

func WithClientOptions[T any](copts ...api.ClientOption) Opt[T]

func WithLogger

func WithLogger[T any](l *slog.Logger) Opt[T]

func WithPayloadDecoder

func WithPayloadDecoder[T any](decFn DecoderFn[T]) Opt[T]

func WithPayloadEncoder

func WithPayloadEncoder[T any](encFn EncoderFn[T]) Opt[T]

Jump to

Keyboard shortcuts

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