db

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2019 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package db implements database interactions.

Package db implements database interactions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Params

type Params struct {
	URL        string
	DB         string
	Collection string
	Username   string
	Password   string
}

Params is a database connection parameters.

type Repository

type Repository interface {
	Store(logModel *models.LogModel) (string, error)
	Update(id string, logModel models.LogModel) error
	Delete(id string) error
	Drop() error
	Close()
}

Repository is a contract for databases

func Connect

func Connect(dbType StorageType, params Params) (Repository, error)

Connect establish connection to passed database type

type StorageType

type StorageType uint

StorageType is a storage type.

const (

	// StorageTypeMongo - mongo mongoDB type
	StorageTypeMongo StorageType
)

func (StorageType) String

func (i StorageType) String() string

func (StorageType) Valid

func (i StorageType) Valid() bool

Valid checks if storage type is in a valid value range.

Jump to

Keyboard shortcuts

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