postgres_service

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

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

Go to latest
Published: Mar 13, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadConfig

func LoadConfig(confFilePath *string) map[string]PostgresConfig

Types

type PostgreSqlConn

type PostgreSqlConn struct {
	Host     string
	Port     string
	User     string
	Pass     string
	DbName   string
	DbClient *sql.DB

	DbClientPg *gorm.DB
}

func (*PostgreSqlConn) Close

func (c *PostgreSqlConn) Close()

func (*PostgreSqlConn) GetDatabase

func (c *PostgreSqlConn) GetDatabase(tableName string) *gorm.DB

func (*PostgreSqlConn) Insert

func (c *PostgreSqlConn) Insert(tableName string, record interface{}) error

func (*PostgreSqlConn) Open

func (c *PostgreSqlConn) Open() error

func (*PostgreSqlConn) Update

func (c *PostgreSqlConn) Update(tableName string, record interface{}) error

func (*PostgreSqlConn) Upsert

func (c *PostgreSqlConn) Upsert(tableName string, record interface{}) error

type PostgresConfig

type PostgresConfig struct {
	Nickname           string `json:"nickname"`
	Hostname           string `json:"hostname"`
	Port               int    `json:"port"`
	User               string `json:"user"`
	Password           string `json:"password"`
	Database           string `json:"database"`
	ConnectionPoolSize int    `json:"connectionPoolSize"`
}

type PostgresLogData

type PostgresLogData struct {
	HostNickname string      `json:hostnickname`
	Database     string      `json:database`
	Table        string      `json:table`
	Timestamp    string      `json:timestamp`
	Data         interface{} `json:data`
}

type PostgresService

type PostgresService struct {
	DbConfigs map[string]PostgresConfig
}

func New

func New(configFilePath *string) *PostgresService

func (*PostgresService) Init

func (s *PostgresService) Init(configFilePath *string)

func (*PostgresService) PutData

func (s *PostgresService) PutData(data PostgresLogData) error

type User

type User struct {
	Name string
	Age  int
}

Jump to

Keyboard shortcuts

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