db

package
v1.7.2 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DatabaseDrivers

func DatabaseDrivers() []string

func EnableDatabase

func EnableDatabase(engine *common.ScriptEngine) error

Types

type Database

type Database struct {
	Driver    string
	DSN       string
	Timeout   time.Duration
	Isolation sql.IsolationLevel
	// contains filtered or unexported fields
}

func NewDatabase

func NewDatabase(driver, dsn string) (*Database, error)

func (*Database) Begin

func (database *Database) Begin() error

func (*Database) Close

func (database *Database) Close() error

func (*Database) Commit

func (database *Database) Commit() error

func (*Database) Execute

func (database *Database) Execute(sqlcmd string, args ...any) (int64, error)

func (*Database) Init

func (database *Database) Init(driver, dsn string) error

func (*Database) Open

func (database *Database) Open() error

func (*Database) Query

func (database *Database) Query(sqlcmd string, args ...any) (*Resultset, error)

func (*Database) Rollback

func (database *Database) Rollback() error

type Field

type Field struct {
	Value  any  `json:"value"`
	IsNull bool `json:"isnull"`
}

func (*Field) String

func (f *Field) String() string

type Resultset

type Resultset struct {
	ColumnNames []string
	RowCount    int
	Rows        any
}

func (*Resultset) Get

func (rs *Resultset) Get(row int, fieldName string) (Field, error)

Jump to

Keyboard shortcuts

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