conn

package
v0.0.0-beta42 Latest Latest
Warning

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

Go to latest
Published: Dec 26, 2024 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Overview

Package conn @author: Violet-Eva @date : 2024/12/24 @notes :

Package conn @author: Violet-Eva @date : 2024/12/19 @notes :

Package conn @author: Violet-Eva @date : 2024/12/24 @notes :

Package conn @author: Violet-Eva @date : 2024/12/24 @notes :

Index

Constants

View Source
const (
	DefaultKrbConfPath  = "/etc/krb5.conf"
	DefaultKinitProgram = "/usr/bin/kinit"
)

Variables

This section is empty.

Functions

func InitGormDB

func InitGormDB(dbType, dbName, user, passwd, host string, port, retryCount, retryInterval, maxIdleConn, maxOpenConn, maxLifetime int, opts ...string) (gormDB *gorm.DB, err error)

Types

type Address

type Address struct {
	Host string
	Port int
	// binary http
	Mode string
}

type HiveConn

type HiveConn struct {
	KA            *KrbAuth
	HCI           *HiveConnInformation
	Conn          *gohive.Connection
	RetryCount    int
	RetryInterval time.Duration
	QueryTimeout  int
}

func NewHiveConn

func NewHiveConn(retryCount int, retryInterval time.Duration, queryTimeout int, information *HiveConnInformation, auth *KrbAuth) *HiveConn

func (*HiveConn) ExecQuery

func (hc *HiveConn) ExecQuery(query string) ([]map[string]interface{}, error)

func (*HiveConn) ExecQueryBatchSize

func (hc *HiveConn) ExecQueryBatchSize(query string, batchSize int, function ...func(input []map[string]interface{}) error) (err error)

func (*HiveConn) ExecQueryNoResult

func (hc *HiveConn) ExecQueryNoResult(query string) error

func (*HiveConn) ExecQueryToStruct

func (hc *HiveConn) ExecQueryToStruct(query string, data any) error

ExecQueryToStruct @Description: @param query @param data pointer @return []map[string]interface{} @return error

func (*HiveConn) GetHiveConn

func (hc *HiveConn) GetHiveConn() (err error)

type HiveConnInformation

type HiveConnInformation struct {
	Addresses []Address
	// KERBEROS NONE NOSASL LDAP CUSTOM DIGEST-MD5
	Auth          string
	Configuration *gohive.ConnectConfiguration
	ConnTimeout   time.Duration
}

func NewHiveConnInformation

func NewHiveConnInformation(addresses []Address, auth string, service string, fetchSize int64, hiveConfig map[string]string, connTimeout time.Duration) *HiveConnInformation

type KrbAuth

type KrbAuth struct {
	KrbConfPath      string
	KinitProgramPath string
	KeyTabFilePath   string
	Principal        string
}

func NewKrbAuth

func NewKrbAuth(krbConfPath, kinitProgramPath, keyTabFilePath, principal string) *KrbAuth

type PgDB

type PgDB struct {
	PostgresDB   *pgxpool.Conn
	QueryTimeout int
}

func InitPGConn

func InitPGConn(user, passwd, host, dbname string, port, retryCount, retryInterval, queryTimeout int, opts ...string) (pdb *PgDB, err error)

func (*PgDB) ExecQuery

func (p *PgDB) ExecQuery(query string, args ...interface{}) (list []map[string]interface{}, err error)

func (*PgDB) ExecQueryNoResult

func (p *PgDB) ExecQueryNoResult(query string, args ...interface{}) (err error)

func (*PgDB) ExecQueryToString

func (p *PgDB) ExecQueryToString(query string, args ...interface{}) (list []map[string]string, err error)

func (*PgDB) ExecQueryToStruct

func (p *PgDB) ExecQueryToStruct(query string, data any, args ...interface{}) (err error)

type SQLDB

type SQLDB struct {
	QueryTimeOut int
	SQLDB        *sql.DB
}

func InitSQLDB

func InitSQLDB(dbType, dbName, user, passwd, host string, port, retryCount, retryInterval, queryTimeout, maxIdleConn, maxOpenConn, maxLifetime int, opts ...string) (sqlDB *SQLDB, err error)

func (*SQLDB) ExecQuery

func (s *SQLDB) ExecQuery(query string, args ...interface{}) (list []map[string]interface{}, err error)

func (*SQLDB) ExecQueryBatchSize

func (s *SQLDB) ExecQueryBatchSize(query string, batchSize int, function ...func(input []map[string]interface{}) error) (err error)

func (*SQLDB) ExecQueryNoResult

func (s *SQLDB) ExecQueryNoResult(query string, args ...interface{}) (err error)

func (*SQLDB) ExecQueryToString

func (s *SQLDB) ExecQueryToString(query string, args ...interface{}) (list []map[string]string, err error)

func (*SQLDB) ExecQueryToStruct

func (s *SQLDB) ExecQueryToStruct(query string, data any, args ...interface{}) (err error)

Jump to

Keyboard shortcuts

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