dalgo2sql

package module
v0.0.30 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2024 License: MIT Imports: 10 Imported by: 1

README

dalgo2sql

SQL adapter for DALgo - a Database Abstraction Layer in Go.

Status

Lint, Vet, Build, Test Go Report Card GoDoc

Usage

go get github.com/dal-go/dalgo2sql

End2end - is a separate module

For end-to-end testing a SQLite driver is used. To avoid bringing a dependency to SQLite into the consumers of dalgo2sql, the end2end tests are in a separate module.

This is an unusual approach, as usually you would want to bring dependency to underlying driver with a dalgo adapter. But this is not a case for this adapter as database/sql that is referenced by dalgo2sql is an abstraction layer and consumer is free to choose the underlying driver.

License

Free to use and open source under MIT License.

Documentation

Index

Constants

View Source
const Version = "0.0.8"

Version indicates package version

Variables

This section is empty.

Functions

func NewDatabase

func NewDatabase(db *sql.DB, options Options) dal.DB

NewDatabase creates a new instance of DALgo adapter to SQL database

Types

type Field

type Field struct {
	Name string
}

Field defines field

func (Field) String added in v0.0.9

func (v Field) String() string

type Options

type Options struct {
	PrimaryKey []string
	Recordsets map[string]*Recordset
}

Options provides database sqlOptions for DALgo - // TODO: document why & how to use

func (Options) GetRecordsetByKey added in v0.0.9

func (o Options) GetRecordsetByKey(key *dal.Key) *Recordset

func (Options) PrimaryKeyFieldNames added in v0.0.9

func (o Options) PrimaryKeyFieldNames(key *dal.Key) (primaryKey []string)

type Recordset

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

Recordset hold recordset settings

func NewRecordset added in v0.0.9

func NewRecordset(name string, t RecordsetType, primaryKey []dal.FieldRef) *Recordset

func (*Recordset) Name

func (v *Recordset) Name() string

func (*Recordset) PrimaryKey

func (v *Recordset) PrimaryKey() []dal.FieldRef

func (*Recordset) PrimaryKeyFieldNames added in v0.0.9

func (v *Recordset) PrimaryKeyFieldNames() []string

func (*Recordset) Type

func (v *Recordset) Type() RecordsetType

type RecordsetType

type RecordsetType = int

RecordsetType defines type of a database recordset

const (
	// Table identifies a table in a database
	Table RecordsetType = iota
	// View identifies a view in a database
	View
	// StoredProcedure identifies a stored procedure in a database
	StoredProcedure
)

Directories

Path Synopsis
end2end module

Jump to

Keyboard shortcuts

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