dbio

package
v1.2.9 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2024 License: GPL-3.0 Imports: 12 Imported by: 1

README

dbio

dbio is a golang library for all things Database, Storage I/O processing.

The particularly useful struct used are:

Projects using dbio:

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FileNode added in v1.1.15

type FileNode struct {
	URI      string      `json:"uri"`
	IsDir    bool        `json:"is_dir"`
	Size     uint64      `json:"size,omitempty"`
	Created  int64       `json:"created,omitempty"`
	Updated  int64       `json:"updated,omitempty"`
	Owner    string      `json:"owner,omitempty"`
	Columns  iop.Columns `json:"columns,omitempty"`
	Children FileNodes   `json:"children,omitempty"`
	// contains filtered or unexported fields
}

FileNode represents a file node

func (*FileNode) Name added in v1.1.15

func (fn *FileNode) Name() string

func (*FileNode) Path added in v1.1.15

func (fn *FileNode) Path() string

Path returns the path without the prefix

func (*FileNode) Type added in v1.1.15

func (fn *FileNode) Type() Type

Type return the file type

type FileNodes added in v1.1.15

type FileNodes []FileNode

FileNodes represent file nodes

func NewFileNodes added in v1.2.4

func NewFileNodes(nodes []map[string]any) (fns FileNodes)

NewFileNodes creates fileNodes from slice of maps

func (*FileNodes) Add added in v1.1.15

func (fns *FileNodes) Add(ns ...FileNode)

Add adds a new node to list

func (*FileNodes) AddWhere added in v1.1.15

func (fns *FileNodes) AddWhere(pattern *glob.Glob, after int64, ns ...FileNode)

AddWhere adds a new node to list if pattern matches name and after timestamp

func (FileNodes) After added in v1.1.15

func (fns FileNodes) After(ts time.Time) (nodes FileNodes)

After returns the nodes modified after provided time

func (FileNodes) AvgSize added in v1.2.4

func (fns FileNodes) AvgSize() uint64

func (FileNodes) Columns added in v1.1.15

func (fns FileNodes) Columns() map[string]iop.Column

Columns returns a column map

func (FileNodes) Paths added in v1.1.15

func (fns FileNodes) Paths() (paths []string)

Paths give a list of recursive paths

func (FileNodes) Sort added in v1.1.15

func (fns FileNodes) Sort()

Sort sorts the nodes

func (FileNodes) TotalSize added in v1.2.4

func (fns FileNodes) TotalSize() uint64

func (FileNodes) URIs added in v1.1.15

func (fns FileNodes) URIs() (uris []string)

URIs give a list of recursive uris

type Kind

type Kind string

Kind is the connection kind

const (
	// KindDatabase for databases
	KindDatabase Kind = "database"
	// KindFile for files (cloud, sftp)
	KindFile Kind = "file"
	// KindUnknown for unknown
	KindUnknown Kind = ""
)

type Template added in v1.1.14

type Template struct {
	Core           map[string]string `yaml:"core"`
	Metadata       map[string]string `yaml:"metadata"`
	Analysis       map[string]string `yaml:"analysis"`
	Function       map[string]string `yaml:"function"`
	GeneralTypeMap map[string]string `yaml:"general_type_map"`
	NativeTypeMap  map[string]string `yaml:"native_type_map"`
	NativeStatsMap map[string]bool   `yaml:"native_stat_map"`
	Variable       map[string]string `yaml:"variable"`
}

Template is a database YAML template

func (Template) ToData added in v1.1.14

func (template Template) ToData() (data iop.Dataset)

ToData convert is dataset

func (Template) Value added in v1.2.3

func (template Template) Value(path string) (value string)

ToData convert is dataset

type Type

type Type string

Type is the connection type

const (
	TypeUnknown Type = ""

	TypeFileLocal  Type = "file"
	TypeFileHDFS   Type = "hdfs"
	TypeFileS3     Type = "s3"
	TypeFileAzure  Type = "azure"
	TypeFileGoogle Type = "gs"
	TypeFileFtp    Type = "ftp"
	TypeFileSftp   Type = "sftp"
	TypeFileHTTP   Type = "http"

	TypeDbPostgres   Type = "postgres"
	TypeDbRedshift   Type = "redshift"
	TypeDbStarRocks  Type = "starrocks"
	TypeDbMySQL      Type = "mysql"
	TypeDbMariaDB    Type = "mariadb"
	TypeDbOracle     Type = "oracle"
	TypeDbBigTable   Type = "bigtable"
	TypeDbBigQuery   Type = "bigquery"
	TypeDbSnowflake  Type = "snowflake"
	TypeDbSQLite     Type = "sqlite"
	TypeDbDuckDb     Type = "duckdb"
	TypeDbMotherDuck Type = "motherduck"
	TypeDbSQLServer  Type = "sqlserver"
	TypeDbAzure      Type = "azuresql"
	TypeDbAzureDWH   Type = "azuredwh"
	TypeDbTrino      Type = "trino"
	TypeDbClickhouse Type = "clickhouse"
	TypeDbMongoDB    Type = "mongodb"
	TypeDbPrometheus Type = "prometheus"
	TypeDbProton     Type = "proton"
)

func ParseURL added in v1.1.15

func ParseURL(uri string) (uType Type, host string, path string, err error)

ParseURL parses a URL

func ValidateType

func ValidateType(tStr string) (Type, bool)

ValidateType returns true is type is valid

func (Type) DBNameUpperCase

func (t Type) DBNameUpperCase() bool

DBNameUpperCase returns true is upper case is default

func (Type) DefPort

func (t Type) DefPort() int

DefPort returns the default port

func (Type) IsDb

func (t Type) IsDb() bool

IsDb returns true if database connection

func (Type) IsFile

func (t Type) IsFile() bool

IsFile returns true if file connection

func (Type) IsNoSQL

func (t Type) IsNoSQL() bool

IsDb returns true if database connection

func (Type) IsUnknown

func (t Type) IsUnknown() bool

IsUnknown returns true if unknown

func (Type) Kind

func (t Type) Kind() Kind

Kind returns the kind of connection

func (Type) Name

func (t Type) Name() string

Name return the type name

func (Type) NameLong

func (t Type) NameLong() string

NameLong return the type long name

func (Type) String

func (t Type) String() string

String returns string instance

func (Type) Template added in v1.1.14

func (t Type) Template() (template Template, err error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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