MCPcopy Create free account
hub / github.com/temporalio/temporal / newDB

Function newDB

common/persistence/sql/sqlplugin/sqlite/db.go:35–56  ·  view source on GitHub ↗

newDB returns an instance of DB, which is a logical connection to the underlying sqlite database

(
	dbKind sqlplugin.DbKind,
	dbName string,
	xdb *sqlx.DB,
	tx *sqlx.Tx,
	logger log.Logger,
)

Source from the content-addressed store, hash-verified

33// newDB returns an instance of DB, which is a logical
34// connection to the underlying sqlite database
35func newDB(
36 dbKind sqlplugin.DbKind,
37 dbName string,
38 xdb *sqlx.DB,
39 tx *sqlx.Tx,
40 logger log.Logger,
41) *db {
42 mdb := &db{
43 dbKind: dbKind,
44 dbName: dbName,
45 onClose: make([]func(), 0),
46 db: xdb,
47 tx: tx,
48 logger: logger,
49 }
50 mdb.conn = xdb
51 if tx != nil {
52 mdb.conn = tx
53 }
54 mdb.converter = &converter{}
55 return mdb
56}
57
58// BeginTx starts a new transaction and returns a reference to the Tx object
59func (mdb *db) BeginTx(ctx context.Context) (sqlplugin.Tx, error) {

Callers 4

CreateDBMethod · 0.70
setupSQLiteDatabaseMethod · 0.70
BeginTxMethod · 0.70

Calls

no outgoing calls