doormen

package
v0.0.0-...-fcff741 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DoormanDefinition

type DoormanDefinition struct {
	Id          bson.ObjectId   `bson:"_id"`
	Name        string          `bson:"name"`
	Values      []*DoormanValue `bson:"values"`
	OwnerEmails []string        `bson:"emails"`
}

func NewDoormanDefinition

func NewDoormanDefinition(name string, ownerEmails ...string) *DoormanDefinition

func QuickNewDoormanDefinition

func QuickNewDoormanDefinition(name string, probs ...string) *DoormanDefinition

a way to quickly create doormen in tests. do not use in real code. will panic if a doorman is wrongly specify

func (*DoormanDefinition) AsDoormanUpdatePayload

func (dmd *DoormanDefinition) AsDoormanUpdatePayload() ([]byte, error)

func (*DoormanDefinition) AsWriteAccess

func (dmd *DoormanDefinition) AsWriteAccess(email string) bool

func (*DoormanDefinition) CanBeUpdatedBy

func (dmd *DoormanDefinition) CanBeUpdatedBy(dmd2 *DoormanDefinition) error

func (*DoormanDefinition) MarshalJSON

func (dm *DoormanDefinition) MarshalJSON() ([]byte, error)

func (*DoormanDefinition) UnmarshalJSON

func (dm *DoormanDefinition) UnmarshalJSON(data []byte) error

func (*DoormanDefinition) Validate

func (dmd *DoormanDefinition) Validate(author string) (err error)

func (*DoormanDefinition) ValidateDoormanValueNames

func (dmd *DoormanDefinition) ValidateDoormanValueNames() error

func (*DoormanDefinition) ValidateDoormanValueProbabilities

func (dmd *DoormanDefinition) ValidateDoormanValueProbabilities() error

type DoormanId

type DoormanId struct {
	Id   bson.ObjectId `json:"id,omitempty" bson:"_id"`
	Name string        `json:"name" bson:"name"`
}

func (*DoormanId) AsJson

func (wId *DoormanId) AsJson() string

func (*DoormanId) MarshalJSON

func (did *DoormanId) MarshalJSON() ([]byte, error)

func (*DoormanId) UnmarshalJSON

func (did *DoormanId) UnmarshalJSON(data []byte) error

type DoormanValue

type DoormanValue struct {
	Name        string   `json:"name"`
	Probability *big.Rat `json:"probability"`
}

func (*DoormanValue) GetBSON

func (val *DoormanValue) GetBSON() (interface{}, error)

func (*DoormanValue) SetBSON

func (val *DoormanValue) SetBSON(raw bson.Raw) error

Jump to

Keyboard shortcuts

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