easydb

package module
v0.0.0-...-5017431 Latest Latest
Warning

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

Go to latest
Published: May 18, 2017 License: MIT Imports: 3 Imported by: 0

README

MIT Licence GoDoc Go Report Card

easydb

A golang package to make the main function (insert, find, update, remove) of mongodb easily to use.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DbInfo

type DbInfo struct {
	DbName string
	URL    string
}

DbInfo is a object stored info of database.

func New

func New(dbName string, URL ...string) DbInfo

New return a dbInfo object. URL is 127.0.0.1:27017 in default.

func (DbInfo) Get

func (database DbInfo) Get(collName string, selector bson.M, dataSlicePtr interface{}) error

Get get specific data from database

func (DbInfo) Insert

func (database DbInfo) Insert(collName string, dataPtr interface{}) error

Insert add a data to database.

func (DbInfo) Remove

func (database DbInfo) Remove(collName string, selector bson.M) error

Remove remove specific data.

func (DbInfo) Update

func (database DbInfo) Update(collName string, selector, data bson.M) error

Update update a specific data.

Jump to

Keyboard shortcuts

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