Generic repository interface for CRUD and aggregation in Go.
// Source: https://github.com/go-rel/rel | License: MIT | Copyright 2018 Muhammad Surya Asriadie
// Provided via justclaw.it.com; keep this notice with the code.
//go:build go1.18
// +build go1.18
package rel
import (
"context"
"reflect"
)
type EntityRepository[T any] interface {
// Repository returns base Repository wrapped by this EntityRepository.
Repository() Repository
// Iterate through a collection of entities from database in batches.
// This function returns iterator that can be used to loop all entities.
// Limit, Offset and Sort query is automatically ignored.
Iterate(ctx context.Context, query Query, option ...IteratorOption) EntityIterator[T]
// Aggregate over the given field.
// Supported aggregate: count, sum, avg, max, min.
// Any select, group, offset, limi
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key