mysql

package
v1.1.1-0...-dcff8be Latest Latest
Warning

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

Go to latest
Published: May 20, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrorClientConnectionNotInitialized = "the client connection to the database is not initialized"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

func New

func New(config ConfigDB) (client *Client, err error)

New creates a new Client based on the given ConfigDB.

func (*Client) Close

func (c *Client) Close() error

func (*Client) Insert

func (c *Client) Insert(query string, args ...interface{}) (int64, error)

func (*Client) Select

func (c *Client) Select(query string, args ...interface{}) (*sql.Rows, error)

type ConfigDB

type ConfigDB struct {
	Host     string
	User     string
	Password string
	Database string
}

func (*ConfigDB) AddToCommand

func (cfg *ConfigDB) AddToCommand(cmd *cobra.Command)

func (*ConfigDB) AddToViper

func (cfg *ConfigDB) AddToViper(v *viper.Viper)

func (ConfigDB) IsValid

func (cfg ConfigDB) IsValid() bool

func (ConfigDB) NewClient

func (cfg ConfigDB) NewClient() (*Client, error)

Jump to

Keyboard shortcuts

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