Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions model_helpers.go → grabber.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// name it for the time being) includes some helper functions for
// dealing with models. UnmarshalParams is the big utility function
// of this library, but other helpers may show up in the future.
package model_helpers
package rest_grab

import (
"errors"
Expand Down Expand Up @@ -111,7 +111,7 @@ func setValue(target reflect.Value, value interface{}) (parseErr error) {
receiver, ok := target.Interface().(Receiver)
if !ok && target.CanAddr() {
// Try again with the pointer
receiver, ok = target.Addr().Interface().(Receiver)
puller, ok = target.Addr().Interface().(Puller)
}

if ok {
Expand Down
2 changes: 1 addition & 1 deletion missing_fields_error.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package model_helpers
package rest_grab

import (
"strings"
Expand Down
6 changes: 3 additions & 3 deletions receiver.go → puller.go
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package model_helpers
package rest_grab

// A Receiver is a type that performs its own logic related to
// receiving data from a request. This is useful for password types
// (to automatically hash the value) or anything that needs to perform
// some type of validation.
type Receiver interface {
type Puller interface {
// Receive takes a value (as would be sent in a request) and
// attempts to read set the Receiver's value to match the passed
// in value. It returns an error if the value isn't valid or
// can't be parsed to the Receiver.
Receive(interface{}) error
Pull(interface{}) error
}