database

package
v0.7.4 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2022 License: Apache-2.0 Imports: 5 Imported by: 1

Documentation

Index

Constants

View Source
const (
	//CONNECTION_STRING user:password@tcp(host:port)/databaseName
	CONNECTION_STRING = "%s:%s@tcp(%s:%d)/%s"
)

Variables

This section is empty.

Functions

func Connect

func Connect(dbType DatabaseType, connStr string) *sql.DB

func CustomConnect

func CustomConnect(dbType string, connStr string) *sql.DB

func DBBoolean

func DBBoolean(b bool) []uint8

Types

type DBValue

type DBValue struct {
	Value any
}

func (*DBValue) ToBoolean

func (v *DBValue) ToBoolean() bool

func (*DBValue) ToBytes

func (v *DBValue) ToBytes() []byte

func (*DBValue) ToDouble

func (v *DBValue) ToDouble() float64

func (*DBValue) ToFloat

func (v *DBValue) ToFloat() float32

func (*DBValue) ToInt

func (v *DBValue) ToInt() int

func (*DBValue) ToInt64

func (v *DBValue) ToInt64() int64

func (*DBValue) ToString

func (v *DBValue) ToString() string

func (*DBValue) ToTime

func (v *DBValue) ToTime() time.Time

type DatabaseType

type DatabaseType int
const (
	MySQL      DatabaseType = iota // import _ "github.com/go-sql-driver/mysql"
	Oracle                         // import _ "github.com/mattn/go-oci8"
	SqlServer                      // import _ "github.com/denisenkom/go-mssqldb"
	PostgreSql                     // import _ "github.com/lib/pq"
)

type Rows

type Rows struct {
	*sql.Rows
}

func (*Rows) GetByIndex

func (r *Rows) GetByIndex(index int) *DBValue

func (*Rows) GetByIndexDef

func (r *Rows) GetByIndexDef(index int, def string) *DBValue

func (*Rows) GetByName

func (r *Rows) GetByName(fieldName string) *DBValue

func (*Rows) GetByNameDef

func (r *Rows) GetByNameDef(fieldName string, def string) *DBValue

Jump to

Keyboard shortcuts

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