utils

package
v1.0.0 Latest Latest
Warning

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

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

Documentation

Overview

Copyright © 2024 Denys <https://github.com/AnyoneClown> This is my license. There are many like it, but this one is mine. My license is my best friend. It is my life. I must master it as I must master my life.

Copyright © 2024 Denys <https://github.com/AnyoneClown> This is my license. There are many like it, but this one is mine. My license is my best friend. It is my life. I must master it as I must master my life.

Copyright © 2024 Denys <https://github.com/AnyoneClown> This is my license. There are many like it, but this one is mine. My license is my best friend. It is my life. I must master it as I must master my life.

Index

Constants

This section is empty.

Variables

View Source
var ConfigFile string
View Source
var Configs []DBConfig
View Source
var DefaultConfigFile string
View Source
var SupportedDrivers = []string{
	"postgres",
	"sqlite",
	"cockroachdb",
}

Functions

func CreateFileAndDir

func CreateFileAndDir() error

func GetDBString

func GetDBString() (string, error)

func GetLastRecords

func GetLastRecords(db *sqlx.DB, tableName string, limit int) ([]map[string]interface{}, error)

func GetTableColumns

func GetTableColumns(db *sqlx.DB, tableName string) ([]table.Column, error)

func GetTables

func GetTables(db *sqlx.DB) ([]string, error)

func LoadDefaultConfig

func LoadDefaultConfig() error

func SaveConfigs

func SaveConfigs(configs []DBConfig, file string) error

Types

type DBConfig

type DBConfig struct {
	ConfigName string `yaml:"configName"`
	Driver     string `yaml:"driver"`
	Host       string `yaml:"host"`
	Port       int    `yaml:"port"`
	User       string `yaml:"user"`
	Password   string `yaml:"password"`
	Database   string `yaml:"database"`
}
var DefaultConfigData DBConfig

func LoadConfigs

func LoadConfigs(file string) ([]DBConfig, error)

Jump to

Keyboard shortcuts

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