database

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2019 License: GPL-3.0 Imports: 6 Imported by: 1

README

PaySuper MongoDB Driver

Build Status codecov go report

Environment variables:

Name Required Default Description
MONGO_DIAL_TIMEOUT - 10 MongoBD dial timeout in seconds
MONGO_DSN true - MongoBD DSN connection string

Contributing

We feel that a welcoming community is important and we ask that you follow PaySuper's Open Source Code of Conduct in all interactions with the community.

PaySuper welcomes contributions from anyone and everyone. Please refer to each project's style and contribution guidelines for submitting patches and additions. In general, we follow the "fork-and-pull" Git workflow.

The master branch of this repository contains the latest stable release of this component.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option func(*Options)

func DialTimeout

func DialTimeout(t int64) Option

func Dsn

func Dsn(dsn string) Option

func Mode added in v0.0.2

func Mode(t mgo.Mode) Option

type Options

type Options struct {
	Dsn         string   `envconfig:"MONGO_DSN" default:"mongodb://localhost:27017/test"`
	DialTimeout int64    `envconfig:"MONGO_DIAL_TIMEOUT" default:"10"`
	Mode        mgo.Mode `envconfig:"MONGO_MODE" default:"1"`
	// contains filtered or unexported fields
}

func (Options) String

func (c Options) String() (s string)

type Source

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

func NewDatabase

func NewDatabase(options ...Option) (*Source, error)

func (*Source) Clone

func (s *Source) Clone() *Source

func (*Source) Close

func (s *Source) Close()

func (*Source) Collection

func (s *Source) Collection(name string) *mgo.Collection

func (*Source) Drop

func (s *Source) Drop() error

func (*Source) Open

func (s *Source) Open(conn *Options) error

func (*Source) Ping

func (s *Source) Ping() error

Jump to

Keyboard shortcuts

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