shredbx logo
shredbx shredbx shredbx shredbx Personal
  • Home
  • Lab
  • Portfolio
  • Experience
  • Services
  • Profile
  • Contact
AClaude
  • Home
  • Lab
  • Portfolio
  • Experience
  • Services
  • Profile
  • Contact
Andrei Solovev
Packages
Search packages... ⌘K
  • Data & Persistence
    • Databases 3
    • Object Storage 1
    • File Formats 2
    • Enumerations 2
    • Content 1
    • Codegen 2
  • System Integration
    • Secrets 1
    • CLI Tools 5
    • Media Processing 2
    • Adapters 2
  • UI & Components
    • Primitives 1
    • Blocks 1
    • Sections & Layouts 1
    • Entities 1
    • Media 1
    • Utilities 1
    • State & Presenter 1
    • Branding & Style 1
  • Game Engine
    • Framework 1
    • Engine 2
    • Presets 1
    • Vendor 1
Packages/ Data & Persistence/ Databases/ Persistence
Go Package

persistence

Generic persistence layer — CRUD operations with type-safe repositories

Go Ready MD
Repository[M] Generic Pattern go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
type Project struct {
    ID     uuid.UUID `db:"id"`
    Name   string    `db:"name"`
    Status string    `db:"status"`
}

repo := persistence.NewRepository[Project](pool, "projects")

// Type-safe CRUD — compiler enforces Project struct
project, err := repo.FindByID(ctx, id)
all, err := repo.FindAll(ctx, persistence.Query{
    Filter: persistence.Filter{Field: "status", Op: "=", Value: "active"},
    Limit:  25,
})
err = repo.Create(ctx, &Project{Name: "shredbx", Status: "active"})

About

Implements the Repository[M] generic pattern for type-safe database access. Provides composable query builders, filter chains, and transaction support without sacrificing compile-time type safety.

Public API

NameKindSignature
Repositoryinterfacetype Repository[M any] interface
NewRepositoryfuncfunc NewRepository[M any](pool *database.Pool, table string) Repository[M]
Querytypetype Query struct
Filtertypetype Filter struct

Dependencies

Imports (1)

database Go Ready

PostgreSQL adapter — connection pooling, schema isolation, health checks

postgresqlpgxpoolingschema-isolation
4 exports 5 deps

Imported By (1)

repository Go Ready

Domain-specific repositories — typed wrappers for entity persistence

domain-driventyped-repositoriesentity-storage
4 exports 2 deps

Related Packages

database Go Ready

PostgreSQL adapter — connection pooling, schema isolation, health checks

postgresqlpgxpoolingschema-isolation
4 exports 5 deps
repository Go Ready

Domain-specific repositories — typed wrappers for entity persistence

domain-driventyped-repositoriesentity-storage
4 exports 2 deps

Source

github.com/shredbx/sbx-core/pkg/persistence
crudgenericsrepository-patterntype-safe
shredbx logo shredbx shredbx shredbx shredbx Andrei Solovev

Solution Architect & Lead Software Engineer

ExperiencePortfolioResearch & ExperimentsEducationCertificationSkills
GitHub ↗LinkedIn ↗Email ↗
AVAILABLE FOR NEW PROJECTS
// MY LATEST BEATS
Hobby & Interests

Lab

  • The Lab
  • Framework
  • Components
  • Packages
  • Games
  • Process (SDLC)
  • Knowledge
  • Blog

Andrei

  • Portfolio
  • Experience
  • Services
  • Profile
  • Contact
  • Lifestyle

Team

  • Team
  • Andrei
  • Claude

Legal

  • Privacy
  • Terms
  • Cookies
© 2026 shredbx.com. All rights reserved. — Andrei Solovev |