db

package
v0.0.0-...-61a28a1 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2021 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package db contains database configurations and methods for querying.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Database

type Database interface {
	GetConfig() *cfg.DbConfig
	Init()
	Select(tableName string, conditions string) []map[string]interface{}
	TestConnection()
	Insert(inDto InsertDto) error
	Update(upDto UpdateDto) error
}

Database interface is the blueprint for all structs for specific databases.

type DatabaseError

type DatabaseError struct {
	DBName   string      `json:"dbName"`
	ErrMsg   string      `json:"errMsg"`
	KeyName  string      `json:"keyName"`
	KeyValue interface{} `json:"keyVal"`
}

DatabaseError is a custom db error.

func (*DatabaseError) Error

func (e *DatabaseError) Error() string

type Databases

type Databases map[string]*Database

Databases imports, validates and holds information about databases from JSON config files.

func (*Databases) Init

func (d *Databases) Init()

type InsertDto

type InsertDto struct {
	TableName string
	KeyName   string
	KeyValue  interface{}
	Values    map[string]interface{}
}

type UpdateDto

type UpdateDto struct {
	TableName         string
	KeyName           string
	KeyValue          interface{}
	UpdatedColumnName string
	NewValue          interface{}
}

Jump to

Keyboard shortcuts

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