psql

package module
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2024 License: BSD-3-Clause Imports: 9 Imported by: 0

Documentation

Overview

* Copyright 2020 Whiteblock Inc.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

*

  • Copyright 2020 Whiteblock Inc. All rights reserved.
  • Use of this source code is governed by a BSD-style
  • license that can be found in the LICENSE file.

* Copyright 2020 Whiteblock Inc.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetPostgreSQLPreparedArgList added in v1.4.0

func GetPostgreSQLPreparedArgList(cols []string) string

func GetSQLColumns added in v1.0.1

func GetSQLColumns[T any]() []string

func GetSQLColumnsQuoted added in v1.2.0

func GetSQLColumnsQuoted[T any]() []string

func OpenConnectionPool

func OpenConnectionPool(conf Config, log logrus.Ext1FieldLogger) (*sqlx.DB, error)

Types

type Config

type Config struct {
	DBHost     string `env:"DBHOST" env-default:"127.0.0.1"`
	DBPort     int    `env:"DBPORT" env-default:"5432"`
	DBUser     string `env:"DBUSER" env-default:"user"`
	DBPassword string `env:"DBPASSWORD" env-default:"password"`
	DBName     string `env:"DBNAME" env-default:"user"`

	SSLKeyFile      string `env:"DB_SSL_KEY_FILE" env-default:""`
	SSLCertFile     string `env:"DB_SSL_CERT_FILE" env-default:""`
	SSLRootCertFile string `env:"DB_SSL_ROOT_CERT_FILE" env-default:""`

	MaxOpenConns     int `env:"DB_MAX_OPEN" env-default:"5"`
	MaxIdleConns     int `env:"DB_MAX_IDLE" env-default:"2"`
	MaxLifetimeConns int `env:"DB_LIFETIME" env-default:"60"`
}

Config is the configuration of the Postgresql database

func NewConfig

func NewConfig() (out Config, _ error)

NewConfig gets the PSQLConfig from viper

func (Config) IsSSLEnabled added in v1.5.0

func (c Config) IsSSLEnabled() bool

Jump to

Keyboard shortcuts

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