gormapplication

package
v0.0.0-...-9b56418 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2020 License: Apache-2.0 Imports: 10 Imported by: 2

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

func (g *GormBase) Clusters() repository.ClusterRepository

Clusters creates new Clusters repository

func (*GormBase) DB

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

func (*GormBase) IdentityClusters

func (g *GormBase) IdentityClusters() repository.IdentityClusterRepository

IdentityClusters creates new IdentityClusters repository

type GormDB

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

GormDB implements the TransactionManager interface methods for initiating a new transaction

func NewGormDB

func NewGormDB(db *gorm.DB, config *configuration.ConfigurationData, options ...factory.Option) *GormDB

func (*GormDB) BeginTransaction

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

BeginTransaction initiates a new transaction

func (*GormDB) ClusterService

func (g *GormDB) ClusterService() service.ClusterService

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
}

GormTransaction implements the Transaction interface methods for committing or rolling back a transaction

func (*GormTransaction) Commit

func (g *GormTransaction) Commit() error

Commit commits the current transaction

func (*GormTransaction) Rollback

func (g *GormTransaction) Rollback() error

Rollback rolls back current transaction

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