gormapplication

package
v0.0.0-...-42225ac Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2017 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package gormapplication contains the code in charge of managing CRUD operations over all the defined objects in our gorm database.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GormBase

type GormBase struct {
	// contains filtered or unexported fields
}

GormBase is a base struct for gorm implementations of db & transaction

func (*GormBase) DB

func (g *GormBase) DB() *gorm.DB

func (*GormBase) Identities

func (g *GormBase) Identities() account.IdentityRepository

Identities creates new Identity repository

func (*GormBase) OauthStates

func (g *GormBase) OauthStates() auth.OauthStateReferenceRepository

OauthStates returns an oauth state reference repository

func (*GormBase) SpaceResources

func (g *GormBase) SpaceResources() space.ResourceRepository

func (*GormBase) Users

func (g *GormBase) Users() account.UserRepository

Users creates new user repository

type GormDB

type GormDB struct {
	GormBase
	// contains filtered or unexported fields
}

func NewGormDB

func NewGormDB(db *gorm.DB) *GormDB

func (*GormDB) BeginTransaction

func (g *GormDB) BeginTransaction() (application.Transaction, error)

Begin implements TransactionSupport

func (*GormDB) SetTransactionIsolationLevel

func (g *GormDB) SetTransactionIsolationLevel(level TXIsoLevel) error

SetTransactionIsolationLevel sets the isolation level for See also https://www.postgresql.org/docs/9.3/static/sql-set-transaction.html

type GormTransaction

type GormTransaction struct {
	GormBase
}

func (*GormTransaction) Commit

func (g *GormTransaction) Commit() error

Commit implements TransactionSupport

func (*GormTransaction) Rollback

func (g *GormTransaction) Rollback() error

Rollback implements TransactionSupport

type TXIsoLevel

type TXIsoLevel int8

A TXIsoLevel specifies the characteristics of the transaction See https://www.postgresql.org/docs/9.3/static/sql-set-transaction.html

const (
	// TXIsoLevelDefault doesn't specify any transaction isolation level, instead the connection
	// based setting will be used.
	TXIsoLevelDefault TXIsoLevel = iota

	// TXIsoLevelReadCommitted means "A statement can only see rows committed before it began. This is the default."
	TXIsoLevelReadCommitted

	// TXIsoLevelRepeatableRead means "All statements of the current transaction can only see rows committed before the
	// first query or data-modification statement was executed in this transaction."
	TXIsoLevelRepeatableRead

	// TXIsoLevelSerializable means "All statements of the current transaction can only see rows committed
	// before the first query or data-modification statement was executed in this transaction.
	// If a pattern of reads and writes among concurrent serializable transactions would create a
	// situation which could not have occurred for any serial (one-at-a-time) execution of those
	// transactions, one of them will be rolled back with a serialization_failure error."
	TXIsoLevelSerializable
)

Jump to

Keyboard shortcuts

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