db

package
v0.0.0-...-1929ff6 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package db represents API for database operations.

Index

Constants

View Source
const SqliteInMemory = ":memory:"

SqliteInMemory is a special string to use in-memory database. @see https://www.sqlite.org/inmemorydb.html

Variables

This section is empty.

Functions

This section is empty.

Types

type DB

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

DB database.

func New

func New(dial gorm.Dialector, migrate bool) (*DB, error)

New creates a new instance of DB.

func NewFromSqlite

func NewFromSqlite(directory, dbName string, migrate bool) (*DB, error)

NewFromSqlite creates a new instance of DB based on SQLite database.

func NewFromSqliteInMemory

func NewFromSqliteInMemory(migrate bool) (*DB, error)

NewFromSqliteInMemory creates a new instance of DB based on SQLite in-memory database.

func (*DB) Client

func (db *DB) Client() *gorm.DB

Client returns the underlying gorm database.

func (*DB) Close

func (db *DB) Close() error

Close closes the database.

Jump to

Keyboard shortcuts

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