mysql

package
v0.0.0-...-b8150c1 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2021 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	USERNAME = "root"
	PASSWORD = "passwd"
	NETWORK  = "tcp"
	SERVER   = "192.168.31.135"
	PORT     = 3306
	DATABASE = "SSBC"
)

Variables

View Source
var DB *sql.DB

Functions

func CloseDB

func CloseDB() error

func InsertBlock

func InsertBlock(block common.Block)

Types

type User

type User struct {
	ID   int64          `db:"id"`
	Name sql.NullString `db:"name"` //由于在mysql的users表中name没有设置为NOT NULL,所以name可能为null,在查询过程中会返回nil,如果是string类型则无法接收nil,但sql.NullString则可以接收nil值
	Age  int            `db:"age"`
}

Jump to

Keyboard shortcuts

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