package
0.18.3
Repository: https://github.com/zondax/golem.git
Documentation: pkg.go.dev

# Packages

No description provided by the author
No description provided by the author

# README

zdatabase Package

Overview

The zdatabase package serves as an abstraction layer for database interactions within Golang applications. Using GORM as a foundation, it provides a more straightforward and extensible interface for database operations.

Table of Contents

  1. Features
  2. Installation
  3. Usage
  4. Configuration

Features

  • Common Interface: A unified API for different database operations.
  • Extensible: Connector mechanism to add support for additional database types.
  • Robustness: In-built logging and error-handling features.
  • Retry Mechanism: Automatic retries for failed database connections.
  • Mocks: Provides mock implementations for DBConnector and ZDatabase interfaces, making it straightforward to unit test the package components without setting up actual database connections

Installation

```bash go get github.com/zondax/golem/pkg/zdatabase ```

Usage

Here's a quick example demonstrating how to create a new database instance.

```go import ( "github.com/zondax/golem/pkg/zdatabase" "github.com/zondax/golem/pkg/zdatabase/zdbconfig" )

func main() { config := &zdbconfig.Config{ // Connection settings }

db, err := zdatabase.NewInstance(zdbConnector.DBTypeClickhouse, config)
if err != nil {
    panic(err)
}

// Perform operations

} ```

Configuration

The zdatabase package can be configured through the zdbconfig package. Refer to Configuration Documentation for more details.

Support

  • clickhouse
  • postgresql