示例#1
0
文件: agent.go 项目: elos/tyche
func NewAgent(name string, power int, auction *Auction) *Agent {
	return &Agent{
		Life:         autonomous.NewLife(),
		Stopper:      make(autonomous.Stopper),
		auction:      auction,
		stream:       make(Consumer),
		bettingPower: power,
		identifier:   data.ID(name),
	}
}
示例#2
0
文件: db.go 项目: elos/gaia
func (db *DB) ParseID(s string) (data.ID, error) {
	oid, err := mongo.ParseObjectID(s)
	return data.ID(oid.Hex()), err
}
示例#3
0
文件: db.go 项目: elos/gaia
func (db *DB) NewID() data.ID {
	return data.ID(mongo.NewObjectID().Hex())
}