postgres

package
v0.0.0-...-fb7d9fd Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2019 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Overview

http://gobook.io/read/github.com/go-xorm/manual-en-US/

Setup optional env JSON value:

goboot_postgres={
  "name": "Your_Postgres_Service_Name",
  "connection": {
      "max_open": 0,
      "max_idle": 0
  },
  "orm": {
      "enable": false,
      "show_sql": false
  }
}

See the following for connection settings: https://golang.org/pkg/database/sql/#DB.SetMaxIdleConns https://golang.org/pkg/database/sql/#SetMaxOpenConns

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DB

func DB() *sql.DB

func InitDB

func InitDB(env PostgresEnv) *sql.DB

func InitORM

func InitORM(env PostgresEnv) *xorm.Engine

func ORM

func ORM() *xorm.Engine

func Status

func Status() bool

Types

type PostgresEnv

type PostgresEnv struct {
	Name         string `env:"goboot_postgres.name"`
	MaxOpenConns int    `env:"goboot_postgres.connection.max_open"`
	MaxIdleConns int    `env:"goboot_postgres.connection.max_idle"`
	ORMEnable    bool   `env:"goboot_postgres.orm.enable"`
	ORMShowSQL   bool   `env:"goboot_postgres.orm.show_sql"`
}

Jump to

Keyboard shortcuts

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