#repository #transactional #traits #abstract #safe #persistence

typesafe_repository

Abstract data persistence in a safe and unified way

11 releases

0.5.5 Jun 11, 2024
0.5.4 Jun 23, 2023
0.5.3 Apr 28, 2023
0.4.0 Mar 4, 2023
0.1.2 Jan 20, 2023

#448 in Database interfaces

Download history 6/week @ 2024-02-26 4/week @ 2024-03-11 39/week @ 2024-04-01 173/week @ 2024-04-15 134/week @ 2024-06-10

134 downloads per month
Used in typesafe_repository_macro

MIT license

89KB
2K SLoC

Features

  • Identity traits (plus helper types like ValidIdentity and IdentityOf)
  • Repository traits like Add, Get, List
  • No need to use unimplemented!() or blanket implementations- construct your own repository based on set of traits
  • No heavy macro magic
  • Transactional repository traits based on HCons with rollback feature
  • Transactional wrapper for repository, which can be used both as plain repository inheriting behavior of inner repository, or transactional repository
  • Perform operations on many repositories in one transaction

Goals

  • Provide flexible and abstract generic-based repository traits
  • Easy transaction implementation
  • Non-essential features are optional
  • No unsafe and panics
  • No runtime errors caused by library
  • No enforced error types

Roadmap

  • transactional traits and RepositoryWrapper
  • RepositoryWrapper rollback support
  • seamless transactional and non-transactional interop for RepositoryWrapper
  • IdentityBy-like trait for marker structs
  • optional serde support
  • sync/async operations with optional features
  • sync transactions support
  • pointer-based ValidIdentity
  • pass previous operation result as next operation argument in transactions
  • HCons wrapper for more convenient output extraction
  • TransactionRunner settings and different mappers
  • transaction log
  • trait generation based on methods names (like in Spring repositories)

Notes

Many generic bounds were made out of heuristics, so feel free to propose reasonable bound changes

Project is in early stage, expect breaking API changes

Dependencies

~3–15MB
~142K SLoC