connectors

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2026 License: Apache-2.0 Imports: 6 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PtrSlice added in v0.5.0

func PtrSlice[T any](list []T) []*T

PtrSlice returns a slice of pointers to each element (for CollectionConnection list storage).

Types

type CollectionConnection

type CollectionConnection[GQLM any] struct {
	// contains filtered or unexported fields
}

CollectionConnection implements collection accessor interface with pagination

func NewCollectionConnection

func NewCollectionConnection[GQLM any](ctx context.Context, dataAccessor DataAccessor[GQLM], page *gqlmodels.Page) *CollectionConnection[GQLM]

NewCollectionConnection based on query object

func (*CollectionConnection[GQLM]) DecodableCacheValue added in v0.3.6

func (c *CollectionConnection[GQLM]) DecodableCacheValue(data []byte) error

DecodableCacheValue decodes the byte slice from cache back into the collection connection

func (*CollectionConnection[GQLM]) EncodableCacheValue added in v0.3.6

func (c *CollectionConnection[GQLM]) EncodableCacheValue() ([]byte, error)

EncodableCacheValue encodes the collection connection to a byte slice for caching

func (*CollectionConnection[GQLM]) List

func (c *CollectionConnection[GQLM]) List() []GQLM

List returns list of the accounts, as a convenience when edges are not needed.

func (*CollectionConnection[GQLM]) PageInfo

func (c *CollectionConnection[GQLM]) PageInfo() *gqlmodels.PageInfo

PageInfo returns information about pages

func (*CollectionConnection[GQLM]) TotalCount

func (c *CollectionConnection[GQLM]) TotalCount() int

TotalCount returns number of campaigns

type DataAccessor

type DataAccessor[M any] interface {
	FetchDataList(ctx context.Context) ([]M, error)
	CountData(ctx context.Context) (int64, error)
}

DataAccessor is a generic interface for data accessors

type DataAccessorFunc

type DataAccessorFunc[M any] struct {
	FetchDataListFunc func(ctx context.Context) ([]M, error)
	CountDataFunc     func(ctx context.Context) (int64, error)
}

DataAccessorFunc provides a generic implementation of DataAccessor as a function

func (*DataAccessorFunc[M]) CountData

func (d *DataAccessorFunc[M]) CountData(ctx context.Context) (int64, error)

func (*DataAccessorFunc[M]) FetchDataList

func (d *DataAccessorFunc[M]) FetchDataList(ctx context.Context) ([]M, error)

Jump to

Keyboard shortcuts

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