Documentation
¶
Index ¶
- func ApplyPaging[T any](items []*T, paging query.Paging) []*T
- func FilterExpressionAsPredicate[T any](fe query.FilterExpression, item *T) bool
- func InExpressionAsPredicate[T any](ie query.InExpression, item *T) bool
- func JunctionExpressionPredicate[T any](je query.JunctionExpression, item *T) bool
- func LoadAll[T any](ctx context.Context, c GenericInterface[T], fe query.FilterExpression, ...) ([]*T, error)
- func LoadAllInBatch[T any](ctx context.Context, c GenericInterface[T], fe query.FilterExpression, ...) ([]*T, error)
- func NotExpressionAsPredicate[T any](ne query.NotExpression, item *T) bool
- func SimpleExpressionPredicate[T any](se query.SimpleExpression, item *T) bool
- type DecoderFn
- type EncoderFn
- type GenericInterface
- type Opt
- func IdProperty[T any](prop string) Opt[T]
- func ReadOnlyProperties[T any](props []string) Opt[T]
- func SkipProperties[T any](props []string) Opt[T]
- func WithClientOptions[T any](copts ...api.ClientOption) Opt[T]
- func WithLogger[T any](l *slog.Logger) Opt[T]
- func WithPayloadDecoder[T any](decFn DecoderFn[T]) Opt[T]
- func WithPayloadEncoder[T any](encFn EncoderFn[T]) Opt[T]
- type RawInterface
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ApplyPaging ¶ added in v1.0.7
func FilterExpressionAsPredicate ¶ added in v1.0.7
func FilterExpressionAsPredicate[T any](fe query.FilterExpression, item *T) bool
func InExpressionAsPredicate ¶ added in v1.0.7
func InExpressionAsPredicate[T any](ie query.InExpression, item *T) bool
func JunctionExpressionPredicate ¶ added in v1.0.7
func JunctionExpressionPredicate[T any](je query.JunctionExpression, item *T) bool
func LoadAll ¶ added in v1.0.7
func LoadAll[T any](ctx context.Context, c GenericInterface[T], fe query.FilterExpression, orders ...query.Order) ([]*T, error)
func LoadAllInBatch ¶ added in v1.0.7
func LoadAllInBatch[T any](ctx context.Context, c GenericInterface[T], fe query.FilterExpression, batchSize int, orders ...query.Order) ([]*T, error)
func NotExpressionAsPredicate ¶ added in v1.0.7
func NotExpressionAsPredicate[T any](ne query.NotExpression, item *T) bool
func SimpleExpressionPredicate ¶ added in v1.0.7
func SimpleExpressionPredicate[T any](se query.SimpleExpression, item *T) bool
Types ¶
type GenericInterface ¶
type GenericInterface[T any] interface { RawInterface 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)
func NewInMemory ¶ added in v1.0.7
func NewInMemory[T any](isKeyFn func(string, *T) bool, initData []*T) GenericInterface[T]
type Opt ¶
type Opt[T any] func(*generic[T])
func IdProperty ¶ added in v1.0.7
IdProperty can override default ID property ("id")
func ReadOnlyProperties ¶ added in v1.0.7
ReadOnlyProperties sets properties that will not be sent to REST API during create/update operations. Such properties might be generated by backend itself, ie auto_increment columns or timestamps.
func SkipProperties ¶
deprecated: use ReadOnlyProperties.
func WithClientOptions ¶
func WithClientOptions[T any](copts ...api.ClientOption) Opt[T]
func WithPayloadDecoder ¶
func WithPayloadEncoder ¶
Click to show internal directories.
Click to hide internal directories.