mongo

package module
v0.0.0-...-24f41c0 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	MgoDb     = "zerohero"
	CollHeros = "heros"
)

Functions

func DeleteOne

func DeleteOne(name string, collname string) (err error)

DeleteOne responsavel por deletar nosso do heros

func FindOne

func FindOne(name, fatia string, collname string) (mzh interface{}, err error)

FindOne responsavel por buscar nosso do heros

Types

type Appearance

type Appearance struct {
	Gender    string   `json:"gender"`
	Race      string   `json:"race"`
	Height    []string `json:"height"`
	Weight    []string `json:"weight"`
	EyeColor  string   `json:"eye-color"`
	HairColor string   `json:"hair-color"`
}

type Biography

type Biography struct {
	FullName        string   `json:"full-name"`
	AlterEgos       string   `json:"alter-egos"`
	Aliases         []string `json:"aliases"`
	PlaceOfBirth    string   `json:"place-of-birth"`
	FirstAppearance string   `json:"first-appearance"`
	Publisher       string   `json:"publisher"`
	Alignment       string   `json:"alignment"`
}

type Config

type Config struct {
	Srv     string
	DB      string
	Host    string
	User    string
	Pass    string
	Options string
}

func New

func New(srv, host, db, user, pass, options string) Config

func (Config) Connect

func (c Config) Connect()

type Connections

type Connections struct {
	GroupAffiliation string `json:"group-affiliation"`
	Relatives        string `json:"relatives"`
}

type Image

type Image struct {
	URL string `json:"url"`
}

type Powerstats

type Powerstats struct {
	Intelligence string `json:"intelligence"`
	Strength     string `json:"strength"`
	Speed        string `json:"speed"`
	Durability   string `json:"durability"`
	Power        string `json:"power"`
	Combat       string `json:"combat"`
}

type Work

type Work struct {
	Occupation string `json:"occupation"`
	Base       string `json:"base"`
}

type ZeroHero

type ZeroHero struct {
	Response    string      `json:"response"`
	ID          string      `json:"id"`
	UUID        string      `json:"uuid,omitempty" bson:"_id"`
	Name        string      `json:"name"`
	Powerstats  Powerstats  `json:"powerstats"`
	Biography   Biography   `json:"biography"`
	Appearance  Appearance  `json:"appearance"`
	Work        Work        `json:"work"`
	Connections Connections `json:"connections"`
	Image       Image       `json:"image"`
}

func (ZeroHero) InsertOne

func (zh ZeroHero) InsertOne(collname string) (err error)

InsertOne criar doc em mongodb criar o index para deixar unique o campo no banco db.heros.createIndex( { "name": 1 }, { unique: true } )

func (ZeroHero) UpdateOne

func (zh ZeroHero) UpdateOne(name string, collname string) (err error)

UpdateOne responsavel por atualizar nosso do heros

Jump to

Keyboard shortcuts

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