models

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2019 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Chapter

type Chapter struct {
	ID   string   `json:"id" bson:"_id" rethinkdb:"id" db:"chapter_id"`
	Name string   `json:"name" bson:"name" rethinkdb:"name" db:"name"`
	Meta Metadata `json:"meta" bson:"meta" rethinkdb:"meta" db:"meta"`

	Leader  string      `json:"leader_id" bson:"leader_id" rethinkdb:"leader_id" db:"leader_id"`
	Members StringArray `json:"member_ids" bson:"member_ids" rethinkdb:"member_ids" db:"members"`
}

Chapter describes chapter attributes holder

func NewChapter

func NewChapter(name string) *Chapter

NewChapter returns a chapter instance

func (*Chapter) AddMember added in v0.0.1

func (c *Chapter) AddMember(u *User)

AddMember adds the given user as member of chapter

func (*Chapter) RemoveMember added in v0.0.1

func (c *Chapter) RemoveMember(u *User)

RemoveMember removes the given user as member of chapter

func (*Chapter) URN

func (c *Chapter) URN() string

URN returns an uniform resource name for external linking

func (*Chapter) Validate

func (c *Chapter) Validate() error

Validate entity contraints

type Guild

type Guild struct {
	ID   string   `json:"id" bson:"_id" rethinkdb:"id"`
	Name string   `json:"name" bson:"name" rethinkdb:"name"`
	Meta Metadata `json:"meta" bson:"meta" rethinkdb:"meta"`

	Members StringArray `json:"member_ids" bson:"member_ids" rethinkdb:"member_ids"`
}

Guild describes guild attributes holder

func NewGuild

func NewGuild(name string) *Guild

NewGuild returns a guild instance

func (*Guild) AddMember added in v0.0.1

func (c *Guild) AddMember(u *User)

AddMember adds the given user as member of guild

func (*Guild) RemoveMember added in v0.0.1

func (c *Guild) RemoveMember(u *User)

RemoveMember removes the given user as member of guild

func (*Guild) URN

func (c *Guild) URN() string

URN returns an uniform resource name for external linking

func (*Guild) Validate

func (c *Guild) Validate() error

Validate entity contraints

type Metadata

type Metadata map[string][]string

Metadata represents object metadata

func (Metadata) Append added in v0.0.1

func (md Metadata) Append(k string, vals ...string)

Append adds the values to key k, not overwriting what was already stored at that key.

func (Metadata) Get added in v0.0.1

func (md Metadata) Get(k string) []string

Get obtains the values for a given key.

func (Metadata) Has added in v0.0.1

func (md Metadata) Has(k string) bool

Has returns true if metadata has given key

func (Metadata) Len added in v0.0.1

func (md Metadata) Len() int

Len returns the number of items in md.

func (Metadata) Set added in v0.0.1

func (md Metadata) Set(k string, vals ...string)

Set sets the value of a given key with a slice of values.

type Squad

type Squad struct {
	ID   string   `json:"id" bson:"_id" rethinkdb:"id"`
	Name string   `json:"name" bson:"name" rethinkdb:"name"`
	Meta Metadata `json:"meta" bson:"meta" rethinkdb:"meta"`

	ProductOwner string      `json:"product_owner_id" bson:"product_owner_id" rethinkdb:"product_owner_id"`
	Members      StringArray `json:"member_ids" bson:"member_ids" rethinkdb:"member_ids"`
}

Squad describes squad attributes holder

func NewSquad

func NewSquad(name string) *Squad

NewSquad returns a squad instance

func (*Squad) AddMember added in v0.0.1

func (c *Squad) AddMember(u *User)

AddMember adds the given user as member of squad

func (*Squad) RemoveMember added in v0.0.1

func (c *Squad) RemoveMember(u *User)

RemoveMember removes the given user as member of squad

func (*Squad) URN

func (c *Squad) URN() string

URN returns an uniform resource name for external linking

func (*Squad) Validate

func (c *Squad) Validate() error

Validate entity contraints

type StringArray added in v0.0.1

type StringArray []string

StringArray describes string array type

func (*StringArray) AddIfNotContains added in v0.0.1

func (s *StringArray) AddIfNotContains(item string)

AddIfNotContains add item if not already in collection

func (StringArray) Contains added in v0.0.1

func (s StringArray) Contains(item string) bool

Contains checks if item is in collection

func (*StringArray) Remove added in v0.0.1

func (s *StringArray) Remove(item string)

Remove item from collection

type Tribe

type Tribe struct {
	ID   string   `json:"id" bson:"_id" rethinkdb:"id"`
	Name string   `json:"name" bson:"name" rethinkdb:"name"`
	Meta Metadata `json:"meta" bson:"meta" rethinkdb:"meta"`

	Squads StringArray `json:"squad_ids" bson:"squad_ids" rethinkdb:"squad_ids"`
}

Tribe describes tribe attributes holder

func NewTribe

func NewTribe(name string) *Tribe

NewTribe returns a tribe instance

func (*Tribe) AddSquad added in v0.0.1

func (c *Tribe) AddSquad(s *Squad)

AddSquad adds the given squad as member of tribe

func (*Tribe) RemoveSquad added in v0.0.1

func (c *Tribe) RemoveSquad(s *Squad)

RemoveSquad removes the given squad as member of tribe

func (*Tribe) URN

func (c *Tribe) URN() string

URN returns an uniform resource name for external linking

func (*Tribe) Validate

func (c *Tribe) Validate() error

Validate entity contraints

type User

type User struct {
	ID        string   `json:"id" bson:"_id" rethinkdb:"id"`
	Principal string   `json:"principal" bson:"principal" rethinkdb:"principal"`
	Meta      Metadata `json:"meta" bson:"meta" rethinkdb:"meta"`
}

User describes user attributes holder

func NewUser

func NewUser(principal string) *User

NewUser returns an user instance

func (*User) URN

func (u *User) URN() string

URN returns an uniform resource name for external linking

func (*User) Validate

func (u *User) Validate() error

Validate entity contraints

Jump to

Keyboard shortcuts

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