db

package
v0.0.0-...-4c53254 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2015 License: MIT Imports: 6 Imported by: 2

Documentation

Overview

读取配置, 创建全局的 sqlx.DB 对象, 根据 query 创建 Stmt 对象并缓存该对象.

Stmt 对象维持了"没有关闭的数据库连接"的 driver.Stmt 对象, 这个是轻资源, 并不会维持连接不关闭; 如果这些轻资源会有很大的负面影响, 可以考虑 LRU, 不过目前我觉得还没有必要.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CloseAllStmt

func CloseAllStmt()

CloseAllStmt 关闭所有缓存的 Stmt, 释放资源. 一般情况下没有必要调用该函数.

func CloseDB

func CloseDB() error

CloseDB 关闭数据库连接, 释放资源. 一般情况下没有必要调用该函数.

func GetDB

func GetDB() *sqlx.DB

func GetNamedStmt

func GetNamedStmt(query string) (stmt *sqlx.NamedStmt, err error)

func GetStmt

func GetStmt(query string) (stmt *sqlx.Stmt, err error)

Types

This section is empty.

Jump to

Keyboard shortcuts

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