Categorygithub.com/go-jwdk/db-connector
modulepackage
0.2.4
Repository: https://github.com/go-jwdk/db-connector.git
Documentation: pkg.go.dev

# README

db-connector

A jobworker connector with database for go-jwdk/jobworker package.

Supported databases:

  • MySQL
  • Postgres
  • SQLite3

Requirements

Go 1.13+

Installation

This package can be installed with the go get command:

$ go get -u github.com/go-jwdk/db-connector

Usage

MySQL:

import "github.com/go-jwdk/jobworker"
import _ "github.com/go-jwdk/db-connector/mysql"

conn, err := jobworker.Open("mysql", map[string]interface{}{
    "DSN":             "user:password@/dbname",
    "MaxOpenConns":    3,
    "MaxMaxIdleConns": 3,
    "ConnMaxLifetime": time.Minute,
    "NumMaxRetries":   3,
})

Postgres:

import "github.com/go-jwdk/jobworker"
import _ "github.com/go-jwdk/db-connector/postgres"

conn, err := jobworker.Open("postgres", map[string]interface{}{
    "DSN":             "user=pqgotest dbname=pqgotest sslmode=verify-full",
    "MaxOpenConns":    3,
    "MaxMaxIdleConns": 3,
    "ConnMaxLifetime": time.Minute,
    "NumMaxRetries":   3,
})

SQLite3:

import "github.com/go-jwdk/jobworker"
import _ "github.com/go-jwdk/db-connector/sqlite3"

conn, err := jobworker.Open("sqlite3", map[string]interface{}{
    "DSN":             "file:test.db?cache=shared&mode=memory",
    "MaxOpenConns":    3,
    "MaxMaxIdleConns": 3,
    "ConnMaxLifetime": time.Minute,
    "NumMaxRetries":   3,
})

# Functions

No description provided by the author

# Constants

No description provided by the author

# Variables

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

# Structs

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

# Interfaces

No description provided by the author