postgres

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2021 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CleanDatabase

func CleanDatabase(db *gorm.DB)

cleanDatabase 删除表

func GetDB

func GetDB() *gorm.DB

*

  • GetDB

func NewConn

func NewConn() *gorm.DB

func NewPostgresConnection

func NewPostgresConnection() *gorm.DB

*

  • NewConnection
  • 初始化 链接

func ResetDatabase

func ResetDatabase(db *gorm.DB)

func SetupDatabase

func SetupDatabase(db *gorm.DB)

setupDatabase 为了使用一些常用组建

Types

type POSTGRES

type POSTGRES struct {
	Name        string `json:"name"`         // 数据库名称
	Password    string `json:"password"`     // 数据库密码
	User        string `json:"user"`         // 数据库用户
	Host        string `json:"host"`         // host
	Port        string `json:"port"`         // 端口
	TablePrefix string `json:"table_prefix"` // 表前缀
	SSLMODE     string `json:"ssl_mode"`     // ssl mode
}

*

  • POSTGRES
  • 默认PG的配置文件

func NewPOSTGRES

func NewPOSTGRES() *POSTGRES

*

  • NewPOSTGRES
  • 初始化PG dsn

func (*POSTGRES) NewConnection

func (p *POSTGRES) NewConnection() *gorm.DB

*

  • NewConnection
  • 创建链接

Jump to

Keyboard shortcuts

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