rdbms

package
v0.0.0-...-7d43bac Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 19, 2017 License: MIT Imports: 1 Imported by: 4

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

type DbTransaction interface {
	Context() DbContext

	Rollback() error
	Commit() error
}

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).

Directories

Path Synopsis
Package gorm provides support for relational database access using GORM (Object-Relational Mapping)
Package gorm provides support for relational database access using GORM (Object-Relational Mapping)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL