Documentation ¶
Overview ¶
Package rdbms provides support for relational database access.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DbContext ¶
type DbContext interface { BeginTransaction() DbTransaction IsInTransaction() bool system.Disposer }
DbContext represents relational database access mechanism. It is used to insert, modify, delete and query the data. Additionally it can create database transactions.
type DbTransaction ¶
DbTransaction represents transaction in relational database.
type Entity ¶
type Entity struct{}
Entity is object which represents relational data stored in database.
type Repository ¶
type Repository interface { Context() DbContext First(where ...interface{}) (interface{}, error) Find(where ...interface{}) ([]interface{}, error) Save(entity interface{}) error Delete(entity interface{}, where ...interface{}) error }
Repository "Mediates between the domain and data mapping layers using a collection-like interface for accessing domain objects." (Martin Fowler). Repository should represent DDD "Aggregate". This means that each repository method should preserve aggregate consistency. To preserve consistency between several Aggregates use DbTransaction (BeginTransaction() method from DbContext).