Versions in this module Expand all Collapse all v1 v1.24.0 Jan 8, 2024 Changes in this version + func CursorShape() shape.Shape + func ExampleRecordShape() shape.Shape + func FindingRecordsShape() shape.Shape + func OpenSearchRepositoryShape() shape.Shape + func RecordTypeShape() shape.Shape + func UpdateRecordsShape() shape.Shape + func UpdatingPolicyShape() shape.Shape type ExampleRecord + func (r *ExampleRecord) MarshalJSON() ([]byte, error) + func (r *ExampleRecord) UnmarshalJSON(data []byte) error v1.23.0 Jan 6, 2024 Changes in this version type FindingRecords + Before *Cursor type PageResult + Prev *FindingRecords[A] + func (a *PageResult[A]) HasPrev() bool v1.22.0 Jan 4, 2024 v1.21.1 Jan 3, 2024 Changes in this version + func SortFieldShape() shape.Shape type SortField + func (r *SortField) MarshalJSON() ([]byte, error) + func (r *SortField) UnmarshalJSON(data []byte) error v1.21.0 Jan 3, 2024 Changes in this version + func OpenSearchSearchResultHitShape() shape.Shape + func OpenSearchSearchResultHitsShape() shape.Shape + func OpenSearchSearchResultShape() shape.Shape + func PageResultShape() shape.Shape + func RecordShape() shape.Shape + type AppendLoger interface + Append func(b *AppendLog[T]) + Change func(from, to Record[T]) error + Close func() + Delete func(data Record[T]) error + Push func(x Change[T]) + Subscribe func(ctx context.Context, fromOffset int, f func(Change[T])) error + type ExampleRecord struct + Age int + Name string + type OpenSearchSearchResult struct + Hits OpenSearchSearchResultHits[A] + func (r *OpenSearchSearchResult[A]) MarshalJSON() ([]byte, error) + func (r *OpenSearchSearchResult[A]) UnmarshalJSON(data []byte) error + type OpenSearchSearchResultHit struct + Item A + Sort []string + func (r *OpenSearchSearchResultHit[A]) MarshalJSON() ([]byte, error) + func (r *OpenSearchSearchResultHit[A]) UnmarshalJSON(data []byte) error + type OpenSearchSearchResultHits struct + Hits []OpenSearchSearchResultHit[A] + func (r *OpenSearchSearchResultHits[A]) MarshalJSON() ([]byte, error) + func (r *OpenSearchSearchResultHits[A]) UnmarshalJSON(data []byte) error type PageResult + func (r *PageResult[A]) MarshalJSON() ([]byte, error) + func (r *PageResult[A]) UnmarshalJSON(data []byte) error type Record + func (r *Record[A]) MarshalJSON() ([]byte, error) + func (r *Record[A]) UnmarshalJSON(data []byte) error v1.20.2 Dec 15, 2023 v1.20.1 Dec 12, 2023 v1.20.0 Dec 10, 2023 v1.19.0 Nov 10, 2023 Changes in this version + var ErrEmptyCommand = fmt.Errorf("empty command") + var ErrInternalError = fmt.Errorf("internal error") + var ErrInvalidType = fmt.Errorf("invalid type") + var ErrNotFound = fmt.Errorf("not found") + var ErrVersionConflict = fmt.Errorf("version conflict") + var WithOnlyRecordSchemaOptions = schema.WithExtraRules() + func GetEnvOr(key string, defaultValue string) string + type Aggregator interface + Append func(data Record[T]) error + Delete func(data Record[T]) error + GetVersionedIndices func() map[string]Record[schema.Schema] + type AppendLog struct + func NewAppendLog[T any]() *AppendLog[T] + func (a *AppendLog[T]) Append(b *AppendLog[T]) + func (a *AppendLog[T]) Change(from, to Record[T]) error + func (a *AppendLog[T]) Close() + func (a *AppendLog[T]) Delete(data Record[T]) error + func (a *AppendLog[T]) Push(x Change[T]) + func (a *AppendLog[T]) Subscribe(ctx context.Context, fromOffset int, f func(Change[T])) error + type Change struct + After *Record[T] + Before *Record[T] + Deleted bool + Offset int + type Cursor = string + type DynamoDBRepository struct + func NewDynamoDBRepository(client *dynamodb.Client, tableName string) *DynamoDBRepository + func (d *DynamoDBRepository) FindingRecords(query FindingRecords[Record[schema.Schema]]) (PageResult[Record[schema.Schema]], error) + func (d *DynamoDBRepository) Get(key, recordType string) (Record[schema.Schema], error) + func (d *DynamoDBRepository) UpdateRecords(command UpdateRecords[Record[schema.Schema]]) error + type FindingRecords struct + After *Cursor + Limit uint8 + RecordType string + Sort []SortField + Where *predicate.WherePredicates + type InMemoryRepository struct + func NewInMemoryRepository() *InMemoryRepository + func (s *InMemoryRepository) AppendLog() *AppendLog[schema.Schema] + func (s *InMemoryRepository) FindingRecords(query FindingRecords[Record[schema.Schema]]) (PageResult[Record[schema.Schema]], error) + func (s *InMemoryRepository) Get(recordID, recordType string) (Record[schema.Schema], error) + func (s *InMemoryRepository) UpdateRecords(x UpdateRecords[Record[schema.Schema]]) error + type KayedAggregate struct + func NewKeyedAggregate[T, R any](recordTypeName string, supportedRecordTypes []string, ...) *KayedAggregate[T, R] + func (t *KayedAggregate[T, R]) Append(data Record[T]) error + func (t *KayedAggregate[T, R]) Delete(data Record[T]) error + func (t *KayedAggregate[T, R]) GetIndexByKey(key string) R + func (t *KayedAggregate[T, R]) GetVersionedIndices() map[string]Record[schema.Schema] + type KinesisStream struct + func NewKinesisStream(k *kinesis.Client, streamName string) *KinesisStream + func (s *KinesisStream) Process() + func (s *KinesisStream) Pull() chan Change[schema.Schema] + func (s *KinesisStream) Subscribe(ctx context.Context, fromOffset int, f func(Change[schema.Schema])) error + type NoopAggregator struct + func NewNoopAggregator[T, R any]() *NoopAggregator[T, R] + func (n *NoopAggregator[T, R]) Append(data Record[T]) error + func (n *NoopAggregator[T, R]) Delete(data Record[T]) error + func (n *NoopAggregator[T, R]) GetVersionedIndices() map[string]Record[schema.Schema] + type OpenSearchRepository struct + func NewOpenSearchRepository(client *opensearch.Client, index string) *OpenSearchRepository + func (os *OpenSearchRepository) FindingRecords(query FindingRecords[Record[schema.Schema]]) (PageResult[Record[schema.Schema]], error) + func (os *OpenSearchRepository) Get(recordID string, recordType RecordType) (Record[schema.Schema], error) + func (os *OpenSearchRepository) ToSorters(sort []SortField) []any + func (os *OpenSearchRepository) UpdateRecords(command UpdateRecords[Record[schema.Schema]]) error + type PageResult struct + Items []A + Next *FindingRecords[A] + func (a PageResult[A]) HasNext() bool + type Record struct + Data A + ID string + Type string + Version uint16 + func RecordAs[A any](record Record[schema.Schema]) (Record[A], error) + type RecordType = string + type Repository interface + FindingRecords func(query FindingRecords[Record[T]]) (PageResult[Record[T]], error) + Get func(recordID string, recordType RecordType) (Record[T], error) + UpdateRecords func(command UpdateRecords[Record[T]]) error + type SortField struct + Descending bool + Field string + type Storage interface + GetAs func(id string, x *T) error + type UpdateRecords struct + Deleting map[string]T + Saving map[string]T + UpdatingPolicy UpdatingPolicy + func Delete[T any](xs ...Record[T]) UpdateRecords[Record[T]] + func SaveAndDelete(saving, deleting UpdateRecords[Record[schema.Schema]]) UpdateRecords[Record[schema.Schema]] + func Save[T any](xs ...Record[T]) UpdateRecords[Record[T]] + func (s UpdateRecords[T]) IsEmpty() bool + type UpdatingPolicy uint + const PolicyIfServerNotChanged + const PolicyOverwriteServerChanges