conn

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: May 11, 2023 License: Apache-2.0 Imports: 12 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DialGrpcService

func DialGrpcService(ctx context.Context, opt *GrpcDialOptions) (*grpc.ClientConn, error)

DialGrpcService dials to a grpc service

func OpenGorm

func OpenGorm(opt *DbOptions) (*gorm.DB, error)

OpenGorm open a connection to sql database using gorm orm

func OpenSql

func OpenSql(opt *DbOptions) (*sql.DB, error)

OpenSql open a connection to sql database

Types

type DbOptions

type DbOptions struct {
	Name     string
	Dialect  string
	Address  string
	User     string
	Password string
	Schema   string
	ConnPool *DbPoolSettings
}

DbOptions contains parameters for connecting to a SQL database

type DbPoolSettings

type DbPoolSettings struct {
	MaxIdleConns    uint
	MaxOpenConns    uint
	MaxLifetime     time.Duration
	MaxIdleLifetime time.Duration
}

DbPoolSettings contains options for customizing the connection pool

type GrpcDialOptions

type GrpcDialOptions struct {
	ServiceName string
	Address     string
	DialOptions []grpc.DialOption
	K8Service   bool
}

GrpcDialOptions contains options for dialing a grpc service

Jump to

Keyboard shortcuts

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