database_agent

package
v0.0.0-...-2b9086d Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2019 License: MIT Imports: 9 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddHero

func AddHero(hero HeroCharacter)

func AddHeroXp

func AddHeroXp(heroName string, addedXP int)

func FindHeroByName

func FindHeroByName(nameHero string, heroFound *HeroCharacter) error

func GetHexIdFromResult

func GetHexIdFromResult(result *mongo.InsertOneResult) string

utility

func Init

func Init(agent *MongoAgent) error

init

func TestDB

func TestDB(agent *MongoAgent)

Types

type Attribute

type Attribute int

type Character

type Character struct {
	Strength  Attribute
	Intellect Attribute
	Charisma  Attribute
}

type EntryId

type EntryId struct {
	Id [12]byte `bson:"_id,omitempty"`
}

EntryStruct

type EventAdventure

type EventAdventure struct {
	Name   string
	Result string
	Bonus  int
}

type HeroCharacter

type HeroCharacter struct {
	Name   string
	Level  int
	Xp     int
	Points int
	Character
}

type MongoAgent

type MongoAgent struct {
	//extended mongo client
	//wrapper
	ConnectionUrl string

	Error error

	ObjectModel interface{}

	//Login         string
	//Password      string
	mongo.Client
	// contains filtered or unexported fields
}
var DBagent MongoAgent

func (*MongoAgent) AddEvent

func (dbagent *MongoAgent) AddEvent(eventNew EventAdventure)

func (*MongoAgent) AddOne

func (self *MongoAgent) AddOne(value interface{}, table string) string

func (*MongoAgent) AutoMigrate

func (self *MongoAgent) AutoMigrate(object interface{})

func (*MongoAgent) Begin

func (self *MongoAgent) Begin() *MongoAgent

func (*MongoAgent) Commit

func (self *MongoAgent) Commit() *MongoAgent

func (*MongoAgent) Delete

func (self *MongoAgent) Delete(value interface{}) *MongoAgent

func (*MongoAgent) Find

func (self *MongoAgent) Find(valuePointer interface{}, where ...interface{}) *MongoAgent

func (*MongoAgent) FindMany

func (self *MongoAgent) FindMany(objects string, filter interface{}, objectFoundSlice interface{})

func (*MongoAgent) First

func (self *MongoAgent) First(foundObject interface{}, conditions ...interface{}) *MongoAgent

gorm interface find first by id

func (*MongoAgent) FirstOrCreate

func (self *MongoAgent) FirstOrCreate(foundPointer interface{}, conditions ...interface{}) *MongoAgent

func (*MongoAgent) GetConnectionUrl

func (dbagent *MongoAgent) GetConnectionUrl() string

func (*MongoAgent) InitDB

func (agent *MongoAgent) InitDB() error

func (*MongoAgent) Limit

func (self *MongoAgent) Limit(number int) *MongoAgent

func (*MongoAgent) LoadEvents

func (dbagent *MongoAgent) LoadEvents() []EventAdventure

func (*MongoAgent) Model

func (self *MongoAgent) Model(model interface{}) *MongoAgent

func (*MongoAgent) Offset

func (self *MongoAgent) Offset(number int) *MongoAgent

func (*MongoAgent) Related

func (self *MongoAgent) Related(valuePointer interface{}, foregnKey ...string) *MongoAgent

func (*MongoAgent) Save

func (self *MongoAgent) Save(value interface{}) *MongoAgent

func (*MongoAgent) SetModel

func (dbagent *MongoAgent) SetModel(model interface{})

func (*MongoAgent) Update

func (self *MongoAgent) Update(data interface{}) *MongoAgent

func (*MongoAgent) UpdateOne

func (dbagent *MongoAgent) UpdateOne(table string, filter interface{}, update interface{})

func (*MongoAgent) Where

func (self *MongoAgent) Where(conditions ...interface{}) *MongoAgent

Jump to

Keyboard shortcuts

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