Documentation ¶
Index ¶
- func AddResource(r interface{}, actionsOne, actionsMany []Action) error
- func AllResourceTypes() []reflect.Type
- func Decode(contentType string, src io.Reader, dest interface{}) error
- func Encode(contentType string, v interface{}, w io.Writer) error
- func EndpointTestTmp(t *testing.T)
- func NewEmptyClone(obj interface{}) interface{}
- func ValueDeepEqual(v1, v2 interface{}) bool
- type Action
- type Decoder
- type Encoder
- type Error
- type HTTPMethod
- type Resource
- type ResourceType
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddResource ¶
Example ¶
package main import ( "fmt" "github.com/adams-sarah/spec2test" ) func main() { fmt.Println("# before:", len(spec2test.AllResourceTypes())) type MyType struct { Name string } oneActions := []spec2test.Action{ spec2test.Create, spec2test.Read, spec2test.Update, spec2test.Destroy, } manyActions := []spec2test.Action{ spec2test.Read, } err := spec2test.AddResource(MyType{"Sarah"}, oneActions, manyActions) if err != nil { // do something } fmt.Println("# after:", len(spec2test.AllResourceTypes())) }
Output: # before: 0 # after: 1
func AllResourceTypes ¶
func EndpointTestTmp ¶
func NewEmptyClone ¶
func NewEmptyClone(obj interface{}) interface{}
func ValueDeepEqual ¶
func ValueDeepEqual(v1, v2 interface{}) bool
Types ¶
type HTTPMethod ¶
type HTTPMethod int
const ( GET HTTPMethod = iota HEAD POST PUT DELETE TRACE OPTIONS CONNECT PATCH )
Source Files ¶
Click to show internal directories.
Click to hide internal directories.