database

package module
v2.5.0 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2019 License: MIT Imports: 8 Imported by: 2

README

☕️ database GoDoc Build Status codecov Go Report Card

Package database provides PostgreSQL management for Temporal, an easy-to-use interface into distributed and decentralized storage technologies for personal and enterprise use cases.

Usage

go get github.com/RTradeLtd/database/v2
import github.com/RTradeLtd/database/v2

Documentation

Overview

Package database provides PostgreSQL management for Temporal (https://github.com/RTradeLtd/Temporal), an easy-to-use interface into distributed and decentralized storage technologies for personal and enterprise use cases.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LogLevel

type LogLevel string

LogLevel indicates different logging levels

const (
	// LogLevelInfo denotes info-level logging
	LogLevelInfo LogLevel = "info"

	// LogLevelDebug denotes debug-level logging
	LogLevelDebug LogLevel = "debug"
)

type Logger

type Logger interface{ Print(...interface{}) }

Logger defines the database's logging interface

type Manager

type Manager struct {
	DB     *gorm.DB
	Upload *models.UploadManager
}

Manager is used to manage databases

func New

func New(cfg *config.TemporalConfig, opts Options) (*Manager, error)

New is used to init our connection to a database, and return a manager struct

func (*Manager) Close

func (dbm *Manager) Close() error

Close shuts down database connection

func (*Manager) RunMigrations

func (dbm *Manager) RunMigrations()

RunMigrations runs all migrations

type Options

type Options struct {
	RunMigrations  bool
	SSLModeDisable bool
	LogMode        bool
	Logger         Logger
}

Options is used to configure a connection to the database

type PrintLogger

type PrintLogger struct {
	// contains filtered or unexported fields
}

PrintLogger wraps a single logFunc to implement the Logger interface

func NewZapLogger

func NewZapLogger(level LogLevel, l *zap.SugaredLogger) *PrintLogger

NewZapLogger wraps a zap logger in a PrintLogger

func (*PrintLogger) Print

func (p *PrintLogger) Print(args ...interface{})

Print logs the given message

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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