db

package
v0.0.25 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2022 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package db for interacting with database

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConnectionOption

type ConnectionOption struct {
	MaxIdle                int
	MaxLifetime            time.Duration
	MaxOpen                int
	ConnectTimeout         time.Duration
	KeepAliveCheckInterval time.Duration
}

ConnectionOption is db connection option.

func DefaultConnectionOption

func DefaultConnectionOption() *ConnectionOption

DefaultConnectionOption returns sensible conn setting.

type Option

type Option struct {
	Host         string
	Port         int
	Username     string
	Password     string
	DatabaseName string
	AppContext   context.Context
	*ConnectionOption
}

Option - database option.

func NewDatabaseOption

func NewDatabaseOption(host string, port int, username, password, dbName string, conn *ConnectionOption) (*Option, error)

NewDatabaseOption - default factory method.

type Options

type Options func(opt *Option)

Options is functional param for db.Option

func WithAppContext

func WithAppContext(ctx context.Context) Options

WithAppContext ...

func WithConnectionOption

func WithConnectionOption(co *ConnectionOption) Options

WithConnectionOption ...

func WithCredential

func WithCredential(username, password string) Options

WithCredential ...

func WithDatabaseName

func WithDatabaseName(dbName string) Options

WithDatabaseName ...

func WithHostURLAndPort

func WithHostURLAndPort(host string, port int) Options

WithHostURLAndPort ...

Directories

Path Synopsis
Package mongokit provides helper to interact with mongodb storage
Package mongokit provides helper to interact with mongodb storage
Package postgres provide faktory method for postgres db.Option
Package postgres provide faktory method for postgres db.Option
Package rediskit helps to interact with redis storage backend
Package rediskit helps to interact with redis storage backend

Jump to

Keyboard shortcuts

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