Documentation ¶
Overview ¶
Package ventures collects together the handling of all Venture specific requests. Functionality in this package is primarily tested using API tests within the /tests directory of this project.
A Venture is an abstract concept synonymous with projects. The word was selected as a comprimise between the strict professional perpective of work & business and the powerful effectiveness of stories and exploration on informal learning, problem solving, and decision making.
The ability to explore and experiment is often missing or with held from individuals and teams, yet, it's essential to their success and progression. By connecting the sense of adventure and positive feelings it invokes, individuals and teams are able to optimise themselves for their environments which almost always results in a significant increase in it performance, happiness, and active engagement.
Index ¶
- func AssertEqualsModified(t *testing.T, before *Venture, after *Venture)
- func AssertGenericReplyFromReader(t *testing.T, r io.Reader)
- func AssertGenericVenture(t *testing.T, v Venture)
- func AssertGenericVentureSlice(t *testing.T, vens []Venture)
- func AssertOrderlessSlicesEqual(t *testing.T, exp []Venture, act []Venture)
- func AssertVenture(t *testing.T, v Venture)
- func AssertVentureModEquals(t *testing.T, exp Venture, act Venture)
- func AssertVentureSlice(t *testing.T, vens []Venture)
- func AssertVentureSliceModEquals(t *testing.T, exp map[string]Venture, act []Venture)
- func AssertVenturesEqual(t *testing.T, exp []Venture, act []Venture, orderless bool)
- func CreateTables() (err error)
- func Handler(res http.ResponseWriter, req *http.Request)
- type ByVenID
- type ModVenture
- type NewVenture
- type Venture
- func AssertVentureFromReader(t *testing.T, r io.Reader) Venture
- func AssertVentureSliceFromReader(t *testing.T, r io.Reader) []Venture
- func AssertWrappedVentureFromReader(t *testing.T, r io.Reader) (wrapped.WrappedReply, Venture)
- func AssertWrappedVentureSliceFromReader(t *testing.T, r io.Reader) (wrapped.WrappedReply, []Venture)
- func DecodeVenture(r io.Reader) (Venture, error)
- func DecodeVentureSlice(r io.Reader) ([]Venture, error)
- func QueryAll() ([]Venture, error)
- func QueryFor(id string) (*Venture, error)
- func QueryMany(ids []interface{}) ([]Venture, error)
- func RequireSliceOfVentures(t *testing.T, r io.Reader) []Venture
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AssertEqualsModified ¶
AssertEqualsModified asserts that the before Venture equals the after Venture except for the 'LastModified' field which must be greater then the after Venture.
func AssertGenericReplyFromReader ¶
AssertGenericReplyFromReader asserts that reading from an io.Reader produces a generic reply.
func AssertGenericVenture ¶
AssertGenericVenture asserts that a Venture has the required fields populated and in the correct format
func AssertGenericVentureSlice ¶
AssertGenericVentureSlice asserts that a Venture slice has the required fields populated and in the correct format
func AssertOrderlessSlicesEqual ¶
AssertOrderlessSlicesEqual asserts that the two slices contain the same Ventures but differences in order should be ignored
func AssertVenture ¶
AssertVenture asserts that a Venture 'v' has valid content.
func AssertVentureModEquals ¶
AssertVentureModEquals asserts that the two Ventures are equal with the exception of the last_modified field
func AssertVentureSlice ¶
AssertVentureSlice asserts that all Ventures 'vens' have valid content.
func AssertVentureSliceModEquals ¶
AssertVentureSliceModEquals asserts that the two Venture slices are equal with the exception of the last_modified fields
func AssertVenturesEqual ¶
AssertVenturesEqual asserts that 'exp' and 'act' contain the same Ventures. If 'orderless' is true then the slices are ordered by ID first.
func CreateTables ¶
func CreateTables() (err error)
CreateTables creates all the Venture tables, views and triggers within the supplied database.
Types ¶
type ModVenture ¶
type ModVenture struct { IDs string `json:"ids"` Props string `json:"set"` Values Venture `json:"values"` }
ModVenture represents an update to a Venture.
func DecodeModVenture ¶
func DecodeModVenture(r io.Reader) (ModVenture, error)
DecodeModVenture decodes a ModVenture from data obtained via a Reader.
func (*ModVenture) ApplyMod ¶
func (mv *ModVenture) ApplyMod(ven *Venture)
ApplyMod applies the modifications to the supplied Venture only touching those properties the user has specified
func (*ModVenture) Clean ¶
func (mv *ModVenture) Clean()
Clean cleans up the ModVenture by removing whitespace where applicable.
func (*ModVenture) SplitIDs ¶
func (mv *ModVenture) SplitIDs() []string
SplitIDs returns the IDs of the Ventures to update as a slice.
func (*ModVenture) SplitProps ¶
func (mv *ModVenture) SplitProps() []string
SplitProps returns the property names of the properties to update.
func (*ModVenture) Update ¶
func (mv *ModVenture) Update() ([]Venture, bool)
Update pushes the modification of changes to the database.
func (*ModVenture) Validate ¶
func (mv *ModVenture) Validate() []string
Validate checks each field contains valid content returning a non-empty slice of human readable error messages detailing the violations found or an empty slice if all is well. These messages are suitable for returning to clients.
type NewVenture ¶
type NewVenture struct { Description string `json:"description"` Orders string `json:"orders"` State string `json:"state"` Extra string `json:"extra"` }
NewVenture represents a new Venture.
func DecodeNewVenture ¶
func DecodeNewVenture(r io.Reader) (NewVenture, error)
DecodeNewVenture decodes a NewVenture from data obtained via a Reader
func (*NewVenture) Clean ¶
func (nv *NewVenture) Clean()
Clean removes redundent whitespace from property values within a Venture except where whitespace is allowable.
func (*NewVenture) Insert ¶
func (nv *NewVenture) Insert() (ven *Venture, ok bool)
Insert inserts the NewVenture into the database
func (*NewVenture) Validate ¶
func (nv *NewVenture) Validate() []string
Validate checks each field contains valid content returning a non-empty slice of human readable error messages detailing the violations found or an empty slice if all is well. These messages are suitable for returning to clients.
type Venture ¶
type Venture struct { ID string `json:"id,omitempty"` LastModified int64 `json:"last_modified"` Description string `json:"description"` Orders string `json:"orders,omitempty"` State string `json:"state"` Dead bool `json:"dead,omitempty"` Extra string `json:"extra,omitempty"` }
Venture represents a Venture, aka, project.
func AssertVentureFromReader ¶
AssertVentureFromReader asserts that a Venture decoded from an io.Reader has the required fields populated and in the correct format
func AssertVentureSliceFromReader ¶
AssertVentureSliceFromReader asserts that a Venture slice decoded from an io.Reader has the required fields populated and in the correct format
func AssertWrappedVentureFromReader ¶
AssertWrappedVentureFromReader asserts that a Venture wrapped within a WrappedReply and decoded from an io.Reader has the required fields populated and in the correct format
func AssertWrappedVentureSliceFromReader ¶
func AssertWrappedVentureSliceFromReader(t *testing.T, r io.Reader) (wrapped.WrappedReply, []Venture)
AssertWrappedVentureSliceFromReader asserts that a Venture slice wrapped within a WrappedReply and decoded from an io.Reader has the required fields populated and in the correct format
func DecodeVenture ¶
DecodeVenture decodes a Venture from data obtained via a Reader.
func DecodeVentureSlice ¶
DecodeVentureSlice decodes a slice of Ventures from data obtained via a Reader.
func RequireSliceOfVentures ¶
RequireSliceOfVentures asserts that the value decoded from 'r' is a slice of valid Ventures; the slice is returned.
func (*Venture) Clean ¶
func (ven *Venture) Clean()
Clean removes redundent whitespace from property values within a Venture except where whitespace is allowable.
func (*Venture) SplitOrders ¶
SplitOrders returns the IDs of the Orders as a slice.