sqldb

package
v0.0.0-...-7a4b066 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2021 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package sqldb - handles the database inside the system.

Package sqldb - handles the database inside the system.

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SqlDB

type SqlDB interface {
	// Exec runs database dml insert/update/delete, or ddl create/alter
	Exec(statement string, parameters ...interface{}) (res sql.Result, err error)

	// Query runs a database queriy
	Query(statement string, parameters ...interface{}) (res *sql.Rows, err error)
}

SqlDB represents the database.

func NewSqlDBImplV1

func NewSqlDBImplV1() (SqlDB, error)

SqlDBImplV1 returns a SqlDBImplV1

Example
os.Setenv("DOCKER_NAME", "utest01")
_, err := NewSqlDBImplV1()
fmt.Println(err)

os.Setenv("DOCKER_NAME", "")
_, err = NewSqlDBImplV1()
fmt.Println(err)
Output:

<nil>
<nil>

type SqlDBImplV1

type SqlDBImplV1 struct {
	*sql.DB
}

SqlDBImplV1 implements the SqlDB interface, it is a version for RDBMS.

func (*SqlDBImplV1) Exec

func (db *SqlDBImplV1) Exec(statement string, parameters ...interface{}) (res sql.Result, err error)

Exec runs database dml insert/update/delete, or ddl create/alter

func (*SqlDBImplV1) Query

func (db *SqlDBImplV1) Query(statement string, parameters ...interface{}) (res *sql.Rows, err error)

Query runs a database queriy

Jump to

Keyboard shortcuts

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