model

package
v0.0.0-...-49718d4 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2019 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Mongo = MongoClient{
	Ctx:     context.Background(),
	Timeout: 10 * time.Second,
}

Mongo variable

Functions

func SetUp

func SetUp(uri string)

SetUp set up Mongo variable

Types

type MongoClient

type MongoClient struct {
	Ctx     context.Context
	Client  *mongo.Client
	Timeout time.Duration
}

MongoClient control mongodb

type Person

type Person struct {
	Name string `bson:"name",json:"name"`
	Sex  string `bson:"sex",json:"sex"`
	Age  int    `bson:"age",json:"age"`
	// contains filtered or unexported fields
}

Person model

func GetPersonByName

func GetPersonByName(name string) ([]*Person, error)

func List

func List() ([]*Person, error)

List get persons

func (*Person) Add

func (p *Person) Add() error

Add add

Jump to

Keyboard shortcuts

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