jsonapi

package
v0.0.0-...-5001978 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2015 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StatusCreated = 1 << iota
	StatusFailed
	StatusHasUserProvidedId
	StatusUserProvidedIdConflict
	StatusUnsupported
)

Variables

This section is empty.

Functions

func Catch

func Catch(f func()) (r interface{})

* Catch() functions similarly to most other languages try-catch... If a panic is thrown within the provided lambda, it will be intercepted and returned as an argument. If no error occurs, the return is nil.

func Check

func Check(e error)

* Check() will call panic(e) if the error provided is non-nil

func DenatureObject

func DenatureObject(data interface{}) map[string]interface{}

func GetField

func GetField(field string, i interface{}) interface{}

func GetFieldByTag

func GetFieldByTag(ider interface{}, realtag string) (reflect.Value, reflect.StructField)

func GetId

func GetId(ider interface{}) string

func GetIdField

func GetIdField(ider interface{}) (reflect.Value, reflect.StructField)

func IsZeroOfUnderlyingType

func IsZeroOfUnderlyingType(x interface{}) bool

func Reply

func Reply(a interface{})

* Reply() is just an alias for panic() -- it is syntax sugar in a few places.

func SetField

func SetField(field string, i interface{}, v interface{})

func SetId

func SetId(ider interface{}, id string) error

func VerifyRelationship

func VerifyRelationship(lb Relationship) bool

Types

type API

type API struct {
	Resources              map[string]*APIMountedResource
	Relationships          map[string]map[string]*APIMountedRelationship
	DefaultResourceWrapper func(*APIMountedResource)
	Router                 *httprouter.Router
	BaseURI                string
	Logger                 Logger
}

*

  • API is the primary user-facing structure within this framework. It
  • provides all of the functionality needed to intialize this framework,
  • as well as all of the glue to step down into more specific functionality

func NewAPI

func NewAPI(baseuri string) *API

func (*API) CentralFindRouter

func (a *API) CentralFindRouter(r *Request, resourcestr, idstr string, preroute []string, outputtype OutputType, linkname string)

func (*API) EntryCreate

func (a *API) EntryCreate(r *Request)

func (*API) EntryDelete

func (a *API) EntryDelete(r *Request)

func (*API) EntryFindDefault

func (a *API) EntryFindDefault(r *Request)

func (*API) EntryFindRecordByResourceAndId

func (a *API) EntryFindRecordByResourceAndId(r *Request)

func (*API) EntryFindRelationshipByNameAndResourceId

func (a *API) EntryFindRelationshipByNameAndResourceId(r *Request)

func (*API) EntryFindRelationshipsByResourceId

func (a *API) EntryFindRelationshipsByResourceId(r *Request)

func (*API) EntryUpdate

func (a *API) EntryUpdate(r *Request)

func (*API) GetRelationship

func (a *API) GetRelationship(srcR, linkName string) *APIMountedRelationship

* GetRelationship() will return a single relationship for a given resource string and relationship string. If the resource or relationship does not exist, this function returns a nil pointer.

func (*API) GetRelationshipsByResource

func (a *API) GetRelationshipsByResource(resource string) map[string]*APIMountedRelationship

* GetRelationshipsByResource() will return a list of all of the relationships that the given resource string can link to.

func (*API) GetResource

func (a *API) GetResource(name string) *APIMountedResource

* GetResource() will return the resource for a given resource string. If the resource does not exist, this function returns a nil pointer.

func (*API) InitRouter

func (a *API) InitRouter()

* InitRouter() prepares the internal httprouter object with all of the desired routes. This is called automatically. You should never have to call this unless you wish to muck around with the httprouter

func (*API) MountRelationship

func (a *API) MountRelationship(name, srcResourceName string, relationship Relationship, authenticator Authenticator)

* MountRelationship() will take a given Relationship and make it available for requests sent to the given API. This also requires providing a source and destination Resource string. These resources must have already been mounted with MountResource() or this function will panic.

func (*API) MountResource

func (a *API) MountResource(name string, resource Resource, authenticators ...Authenticator)

* MountResource() will take a given Resource and make it available for requests sent to the given API. Any Resource that is accessible goes through this function

func (*API) ServeHTTP

func (a *API) ServeHTTP(w http.ResponseWriter, r *http.Request)

* ServeHTTP() is to satisfy net/http.Handler -- all requests are simply forwarded through to httprouter

func (*API) Wrap

func (a *API) Wrap(child func(r *Request)) httprouter.Handle

* Wrap() reroutes a request to a standard httprouter.Handler (? double check) and converts it to the function signature that our entrypoint functions expect. It also initializes our panic handling and our thread pool handling.

type APIMountedRelationship

type APIMountedRelationship struct {
	SrcResourceName string
	Name            string
	Relationship
	Authenticator
}

func (*APIMountedRelationship) Resolve

func (amr *APIMountedRelationship) Resolve(r *Request, src *Record, shouldFetch bool, include *IncludeInstructions) (*ORelationship, []*Record)

func (*APIMountedRelationship) ResolveIds

func (amr *APIMountedRelationship) ResolveIds(r *Request, lb RelationshipLinkIds, record *Record, include *IncludeInstructions) (*ORelationship, []*Record)

func (*APIMountedRelationship) ResolveRecords

func (amr *APIMountedRelationship) ResolveRecords(r *Request, lb RelationshipLinkRecords, record *Record, include *IncludeInstructions) (*ORelationship, []*Record)

type APIMountedResource

type APIMountedResource struct {
	Name string
	Resource
	Authenticator
}

type Authenticator

type Authenticator interface {
	Authenticate(r *Request, permission, id string)
}

type AuthenticatorMany

type AuthenticatorMany struct {
	Authenticators []Authenticator
}

func NewAuthenticatorMany

func NewAuthenticatorMany(authenticators ...Authenticator) *AuthenticatorMany

func (*AuthenticatorMany) Authenticate

func (am *AuthenticatorMany) Authenticate(r *Request, permission, id string)

type Denaturer

type Denaturer interface {
	Denature() interface{}
}

type Ider

type Ider interface {
	Id() string
	SetId(string) error
}

type IncludeInstructions

type IncludeInstructions struct {
	Children map[string]*IncludeInstructions
	Include  []string
	Parent   *IncludeInstructions
}

func NewIncludeInstructions

func NewIncludeInstructions(rawinst string) *IncludeInstructions

func NewIncludeInstructionsEmpty

func NewIncludeInstructionsEmpty() *IncludeInstructions

func NewIncludeInstructionsFromRequest

func NewIncludeInstructionsFromRequest(r *http.Request) *IncludeInstructions

func (*IncludeInstructions) GetChild

func (ii *IncludeInstructions) GetChild(childname string) *IncludeInstructions

func (*IncludeInstructions) Push

func (ii *IncludeInstructions) Push(inst_rels []string)

func (*IncludeInstructions) ShouldFetch

func (ii *IncludeInstructions) ShouldFetch(rel string) bool

func (*IncludeInstructions) ShouldInclude

func (ii *IncludeInstructions) ShouldInclude(inst string) bool

type LeasedPromise

type LeasedPromise struct {
	Promise
	ChanRelease chan bool
}

func (*LeasedPromise) Release

func (sp *LeasedPromise) Release()

type Logger

type Logger interface {
	Debugf(fmt string, args ...interface{})
	Infof(fmt string, args ...interface{})
	Warnf(fmt string, args ...interface{})
	Errorf(fmt string, args ...interface{})
	Criticalf(fmt string, args ...interface{})
}

type LoggerDefault

type LoggerDefault struct {
	Output io.Writer
}

func NewLoggerDefault

func NewLoggerDefault(output io.Writer) *LoggerDefault

func (*LoggerDefault) Criticalf

func (l *LoggerDefault) Criticalf(format string, args ...interface{})

func (*LoggerDefault) Debugf

func (l *LoggerDefault) Debugf(format string, args ...interface{})

func (*LoggerDefault) Errorf

func (l *LoggerDefault) Errorf(format string, args ...interface{})

func (*LoggerDefault) GetCaller

func (l *LoggerDefault) GetCaller(depth int) string

func (*LoggerDefault) GetTime

func (l *LoggerDefault) GetTime() string

func (*LoggerDefault) Infof

func (l *LoggerDefault) Infof(format string, args ...interface{})

func (*LoggerDefault) PrepareArgs

func (l *LoggerDefault) PrepareArgs(args []interface{}) []interface{}

func (*LoggerDefault) Warnf

func (l *LoggerDefault) Warnf(format string, args ...interface{})

type OData

type OData interface{}

OData is an interface used to represent the various forms of the primary data in the Output object. Currently, OutputData is an empty interface, so the use of this is purely syntactical. As of writing, the objects written in this file alongside OutputData are intended to be used as OutputData.

type OError

type OError struct {
	Id     string        `json:"id,omitempty"`
	Href   string        `json:"href,omitempty"`
	Status string        `json:"status,omitempty"`
	Code   string        `json:"code,omitempty"`
	Title  string        `json:"title,omitempty"`
	Detail string        `json:"detail,omitempty"`
	Source *OErrorSource `json:"source,omitempty"`
	Meta   interface{}   `json:"meta,omitempty"`
}

type OErrorSource

type OErrorSource struct {
	Pointer   string `json:"pointer,omitempty"`
	Parameter string `json:"parameter,omitempty"`
}

type OMeta

type OMeta map[string]interface{}

type ORecords

type ORecords struct {
	IsSingle bool
	Records  []*Record
}

ORecords is a struct that satisfies OData, and represents a list of potentially many Records. A list of zero records is possible. Attempting to encode this object as JSON with a list of more than one Record when IsSingle = true will cause a panic.

func (ORecords) MarshalJSON

func (o ORecords) MarshalJSON() ([]byte, error)

type ORelationship

type ORelationship struct {
	IsSingle bool `json:"-"`
	//Links OLinks `json:"links,omitempty"`
	Data             []OResourceIdentifier `json:"data"`
	Meta             OMeta                 `json:"meta,omitempty"`
	RelatedBase      string                `json:"-"`
	RelationshipName string                `json:"-"`
}

func (*ORelationship) MarshalJSON

func (o *ORelationship) MarshalJSON() ([]byte, error)

type ORelationships

type ORelationships struct {
	Relationships []*ORelationship
}

func (*ORelationships) GetRelationshipByName

func (o *ORelationships) GetRelationshipByName(name string) *ORelationship

func (*ORelationships) MarshalJSON

func (o *ORelationships) MarshalJSON() ([]byte, error)

type OResourceIdentifier

type OResourceIdentifier struct {
	Id   string `json:"id"`
	Type string `json:"type"`
}

func GetRelationshipDifferences

func GetRelationshipDifferences(src, dst []OResourceIdentifier) (add, remove []OResourceIdentifier)

func NewResourceIdentifier

func NewResourceIdentifier(id, typ string) OResourceIdentifier

type Output

type Output struct {
	Data OData `json:"data,omitempty"`
	//Links *OutputLinks `json:"links, omitempty"`
	Included []*Record `json:"included,omitempty"`
	Errors   []OError  `json:"errors,omitempty"`
	Meta     OMeta     `json:"meta,omitempty"`
}

* Output is the primary output structure used by this framework. It is responsible for representing the root node of every spec-compliant response this framework can generate.

func NewOutput

func NewOutput() *Output

type OutputType

type OutputType int
const (
	OutputTypeResources OutputType = iota
	OutputTypeLinkages
)

type Paginator

type Paginator struct {
	ShouldPaginate bool
	CurPage        int
	LastPage       int
	MaxPerPage     int
}

func NewPaginator

func NewPaginator(r *Request) Paginator

type Promise

type Promise interface {
	Success(r *Request)
	Failure(r *Request)
}

type PromiseStorage

type PromiseStorage struct {
	Promises map[reflect.Type]chan PromiseStorageLease
	ChanGet  chan PromiseStorageLease
}

func NewPromiseStorage

func NewPromiseStorage() *PromiseStorage

func (*PromiseStorage) Defer

func (ps *PromiseStorage) Defer()

func (*PromiseStorage) Get

func (ps *PromiseStorage) Get(typ Promise, init func() Promise) LeasedPromise

func (*PromiseStorage) PromiseWorker

func (ps *PromiseStorage) PromiseWorker(p Promise) chan PromiseStorageLease

func (*PromiseStorage) Worker

func (ps *PromiseStorage) Worker()

type PromiseStorageLease

type PromiseStorageLease struct {
	Type         reflect.Type
	Initialize   func() Promise
	ChanResponse chan LeasedPromise
}

type Record

type Record struct {
	// exposed fields
	Type       string           `json:"type"`
	Id         string           `json:"id"`
	Attributes RecordAttributes `json:"attributes,omitempty"`
	//Links //TODO
	Relationships *ORelationships `json:"relationships,omitempty"`
	Meta          OMeta           `json:"meta,omitempty"`

	// internal fields for tracking
	ShouldInclude bool `json:"-"`
	// contains filtered or unexported fields
}

func ParseJSONHelper

func ParseJSONHelper(v *Record, raw []byte, t reflect.Type) (*Record, error)

func (*Record) Denature

func (r *Record) Denature() interface{}

func (*Record) GetRelationships

func (r *Record) GetRelationships() *TaskFindLinksByRecordResult

func (*Record) GetResourceIdentifier

func (r *Record) GetResourceIdentifier() OResourceIdentifier

func (*Record) PrepareRelationships

func (r *Record) PrepareRelationships(req *Request, ii *IncludeInstructions)

type RecordAttributes

type RecordAttributes interface{}

type RecordCreatedStatus

type RecordCreatedStatus uint

type RecordParserSimple

type RecordParserSimple struct {
	Data *Record `json:"data"`
}

type Relationship

type Relationship interface {
	IsSingle() bool
	PostMount(a *API)
	VerifyLinks(r *Request, rec *Record, amr *APIMountedRelationship, rids []OResourceIdentifier) error
	PreSave(r *Request, rec *Record, amr *APIMountedRelationship, rids []OResourceIdentifier) error
	PostSave(r *Request, rec *Record, amr *APIMountedRelationship, rids []OResourceIdentifier) error
}

RelationshipBehavior is a "base interface" children: IdRelationshipBehavior or a HasIdRelationshipBehavior

type RelationshipLinkIds

type RelationshipLinkIds interface {
	Relationship
	LinkIds(r *Request, srcR *APIMountedResource, rel *APIMountedRelationship, src *Record) (ids []OResourceIdentifier)
}

type RelationshipLinkRecords

type RelationshipLinkRecords interface {
	Relationship
	LinkRecords(r *Request, srcR *APIMountedResource, rel *APIMountedRelationship, src *Record) (dst []*Record)
}

type RelationshipRequirement

type RelationshipRequirement int
const (
	Required RelationshipRequirement = iota
	NotRequired
)

type Request

type Request struct {
	HttpRequest         *http.Request
	HttpResponseWriter  http.ResponseWriter
	API                 *API
	Params              httprouter.Params
	IncludeInstructions *IncludeInstructions
	TaskContext         *TaskContext
	PromiseStorage      *PromiseStorage
	// contains filtered or unexported fields
}

* Request is responsible for managing all of the common information between resources and relationships for the duration of a request. It contains references to often-needed components such as the raw net/http.Request, the API object, etc

func NewRequest

func NewRequest(a *API, httpreq *http.Request, httpres http.ResponseWriter, params httprouter.Params) *Request

* NewRequest() will return a populated instance of *Request. It will also initialize concurrency components.

func (*Request) Defer

func (r *Request) Defer()

* Defer() should be called in a defer call at the same point that a Request is initialized. It is responsible for the safe handling of responses

func (*Request) Failure

func (r *Request) Failure()

* Failure() is responsible for calling the appropriate failure handles. This function should never be called outside of a Responder

func (*Request) GetBaseURL

func (r *Request) GetBaseURL() string

* GetBaseURL() will provide the URL + URI for any arbitrary request such that curling the output of this function is the root API endpoint for requests to this instance of this framework.

func (*Request) HandlePanic

func (r *Request) HandlePanic(raw interface{}) (is_valid bool)

* HandlePanic() is responsible for interpreting the object that was paniced, and replying with the appropriate answer.

func (*Request) Push

func (r *Request) Push(t_list ...Task)

* Push() is an alias for TaskContext.Push()

func (*Request) Send

func (r *Request) Send(obj interface{})

* Send() is responsible for converting a given *Output object to json, and sending it to the HttpResponseWriter that this Request is responsible for.

func (*Request) Success

func (r *Request) Success()

* Success() is responsible for calling the appropriate succcess handles. This function should never be called outside of a Responder

type RequestParams

type RequestParams struct {
	Paginator Paginator
}

type Resource

type Resource interface {
	FindDefault(r *Request, rp RequestParams) ([]*Record, error)
	FindOne(r *Request, rp RequestParams, id string) (*Record, error)
	FindMany(r *Request, rp RequestParams, ids []string) ([]*Record, error)
	FindManyByField(r *Request, rp RequestParams, field, value string) ([]*Record, error)
	// TODO: this iss necessary for optimizations but the backend
	// does not easily support this right now
	//FindManyByFieldWithManyValues(field string, []value string) ([]Ider, error)
	Delete(r *Request, id string) error
	ParseJSON(r *Request, src *Record, raw []byte) (dst *Record, err error)
	Create(r *Request, record *Record) (status RecordCreatedStatus, err error)
	Update(r *Request, record *Record) error
}

type ResourceTypeSetter

type ResourceTypeSetter struct {
	Parent       Resource
	Name         string
	SetEmptyOnly bool
}

func NewResourceTypeSetter

func NewResourceTypeSetter(parent Resource, name string, setEmptyOnly bool) *ResourceTypeSetter

func (*ResourceTypeSetter) Create

func (rts *ResourceTypeSetter) Create(r *Request, record *Record) (RecordCreatedStatus, error)

func (*ResourceTypeSetter) Delete

func (rts *ResourceTypeSetter) Delete(r *Request, id string) error

func (*ResourceTypeSetter) FindDefault

func (rts *ResourceTypeSetter) FindDefault(r *Request, rp RequestParams) ([]*Record, error)

func (*ResourceTypeSetter) FindMany

func (rts *ResourceTypeSetter) FindMany(r *Request, rp RequestParams, ids []string) ([]*Record, error)

func (*ResourceTypeSetter) FindManyByField

func (rts *ResourceTypeSetter) FindManyByField(r *Request, rp RequestParams, field, value string) ([]*Record, error)

func (*ResourceTypeSetter) FindOne

func (rts *ResourceTypeSetter) FindOne(r *Request, rp RequestParams, id string) (*Record, error)

func (*ResourceTypeSetter) ParseJSON

func (rts *ResourceTypeSetter) ParseJSON(r *Request, src *Record, raw []byte) (*Record, error)

func (*ResourceTypeSetter) Set

func (rts *ResourceTypeSetter) Set(records *[]*Record)

func (*ResourceTypeSetter) Update

func (rts *ResourceTypeSetter) Update(r *Request, record *Record) error

type Responder

type Responder interface {
	Respond(req *Request) error
}

type ResponderBase

type ResponderBase struct {
	Output  *Output
	Status  int
	Headers map[string][]string
	CB      func(r *Request)
}

func InsufficientPermissions

func InsufficientPermissions() *ResponderBase

func NewResponderBase

func NewResponderBase(status int, o *Output) *ResponderBase

func NewResponderBaseErrors

func NewResponderBaseErrors(code int, es ...error) *ResponderBase

func NewResponderErrorOperationNotSupported

func NewResponderErrorOperationNotSupported(desc string) *ResponderBase

func NewResponderErrorRelationshipDoesNotExist

func NewResponderErrorRelationshipDoesNotExist(relname string) *ResponderBase

func NewResponderErrorResourceDoesNotExist

func NewResponderErrorResourceDoesNotExist(relname string) *ResponderBase

func NewResponderForbidden

func NewResponderForbidden(e error) *ResponderBase

func NewResponderRecordCreate

func NewResponderRecordCreate(resource_str string, rec *Record, createdStatus RecordCreatedStatus, err error) *ResponderBase

TODO: rip this out and replace it with multiple responder functions... this function should not be internally resonsible for determining success or failure

func NewResponderResourceSuccessfullyDeleted

func NewResponderResourceSuccessfullyDeleted() *ResponderBase

func NewResponderUnimplemented

func NewResponderUnimplemented(e error) *ResponderBase

func TODO

func TODO() *ResponderBase

func Unimplemented

func Unimplemented() *ResponderBase

func (*ResponderBase) PushHeader

func (rb *ResponderBase) PushHeader(k, v string)

func (*ResponderBase) Respond

func (rb *ResponderBase) Respond(r *Request) error

type Task

type Task interface {
	Work(r *Request)
	ResponseWorker(has_paniced bool)
	Cleanup(r *Request)
}

type TaskAttachIncluded

type TaskAttachIncluded struct {
	Parent       TaskResultRecords
	II           *IncludeInstructions
	Output       chan chan *Output
	ActualOutput *Output
	OutputType   OutputType
	Linkname     string
}

func NewTaskAttachIncluded

func NewTaskAttachIncluded(parent TaskResultRecords, ii *IncludeInstructions, outputtype OutputType, linkname string) *TaskAttachIncluded

func (*TaskAttachIncluded) Cleanup

func (w *TaskAttachIncluded) Cleanup(r *Request)

func (*TaskAttachIncluded) GetResult

func (w *TaskAttachIncluded) GetResult() *Output

func (*TaskAttachIncluded) ResponseWorker

func (w *TaskAttachIncluded) ResponseWorker(has_paniced bool)

func (*TaskAttachIncluded) Work

func (t *TaskAttachIncluded) Work(r *Request)

type TaskContext

type TaskContext struct {
	Context chan Task
}

* TaskContext's primary responsibility is managing a set of Tasks. It is also responsible for capturing panics and ensuring that every other task is informed of this such that as little computational power is wasted as possible once we are certain of our response.

func NewTaskContext

func NewTaskContext(r *Request) *TaskContext

* NewTaskContext() creates and initializes a *TaskContext object, and initializes its worker goroutine

func (*TaskContext) Cleanup

func (w *TaskContext) Cleanup()

func (*TaskContext) Push

func (w *TaskContext) Push(t_list ...Task)

type TaskCreate

type TaskCreate struct {
	Resource, Id string
	Output       chan chan bool
}

func NewTaskCreate

func NewTaskCreate(resource, id string) *TaskCreate

func (*TaskCreate) Cleanup

func (t *TaskCreate) Cleanup(r *Request)

func (*TaskCreate) ResponseWorker

func (t *TaskCreate) ResponseWorker(has_paniced bool)

func (*TaskCreate) Wait

func (t *TaskCreate) Wait() bool

func (*TaskCreate) Work

func (t *TaskCreate) Work(r *Request)

type TaskDelete

type TaskDelete struct {
	Resource, Id string
	Result       bool
	Output       chan chan bool
}

func NewTaskDelete

func NewTaskDelete(resource, id string) *TaskDelete

func (*TaskDelete) Cleanup

func (t *TaskDelete) Cleanup(r *Request)

func (*TaskDelete) ResponseWorker

func (t *TaskDelete) ResponseWorker(has_paniced bool)

func (*TaskDelete) Wait

func (t *TaskDelete) Wait() bool

func (*TaskDelete) Work

func (t *TaskDelete) Work(r *Request)

type TaskFindByIds

type TaskFindByIds struct {
	Resource    string
	Ids         []string
	Output      chan chan *TaskResultRecordData
	Result      *TaskResultRecordData
	II          *IncludeInstructions
	ViaLinkName string
	Paginator   Paginator
}

func NewTaskFindByIds

func NewTaskFindByIds(resource string, ids []string, ii *IncludeInstructions, vln string, Paginator Paginator) *TaskFindByIds

func (*TaskFindByIds) Cleanup

func (t *TaskFindByIds) Cleanup(r *Request)

func (*TaskFindByIds) GetResult

func (t *TaskFindByIds) GetResult() *TaskResultRecordData

func (*TaskFindByIds) ResponseWorker

func (t *TaskFindByIds) ResponseWorker(has_paniced bool)

func (*TaskFindByIds) Work

func (t *TaskFindByIds) Work(r *Request)

type TaskFindLinksByRecord

type TaskFindLinksByRecord struct {
	Record *Record
	II     *IncludeInstructions
	Output chan chan *TaskFindLinksByRecordResult
	Result *TaskFindLinksByRecordResult
}

func NewTaskFindLinksByRecord

func NewTaskFindLinksByRecord(r *Record, ii *IncludeInstructions) *TaskFindLinksByRecord

func (*TaskFindLinksByRecord) Cleanup

func (t *TaskFindLinksByRecord) Cleanup(r *Request)

func (*TaskFindLinksByRecord) GetResult

func (*TaskFindLinksByRecord) ResponseWorker

func (t *TaskFindLinksByRecord) ResponseWorker(has_paniced bool)

func (*TaskFindLinksByRecord) Work

func (t *TaskFindLinksByRecord) Work(r *Request)

type TaskFindLinksByRecordResult

type TaskFindLinksByRecordResult struct {
	Relationships *ORelationships
	Included      []*Record
}

type TaskReplyer

type TaskReplyer struct {
	TaskResultOutput TaskResultOutput
	Output           chan chan bool
}

func NewTaskReplyer

func NewTaskReplyer(wo TaskResultOutput) *TaskReplyer

func (*TaskReplyer) Cleanup

func (w *TaskReplyer) Cleanup(r *Request)

func (*TaskReplyer) ResponseWorker

func (w *TaskReplyer) ResponseWorker(has_paniced bool)

func (*TaskReplyer) Wait

func (w *TaskReplyer) Wait()

func (*TaskReplyer) Work

func (w *TaskReplyer) Work(r *Request)

type TaskResultOutput

type TaskResultOutput interface {
	Task
	GetResult() *Output
}

type TaskResultRecordData

type TaskResultRecordData struct {
	Records   []*Record
	Paginator *Paginator
	IsSingle  bool
}

type TaskResultRecords

type TaskResultRecords interface {
	Task
	GetResult() *TaskResultRecordData
}

type TaskSingleLinkResolver

type TaskSingleLinkResolver struct {
	Parent   TaskResultRecords
	Linkname string
	Output   chan chan *TaskResultRecordData
	Result   *TaskResultRecordData
}

func NewTaskSingleLinkResolver

func NewTaskSingleLinkResolver(t TaskResultRecords, linkname string) *TaskSingleLinkResolver

func (*TaskSingleLinkResolver) Cleanup

func (t *TaskSingleLinkResolver) Cleanup(r *Request)

func (*TaskSingleLinkResolver) GetResult

func (*TaskSingleLinkResolver) ResponseWorker

func (t *TaskSingleLinkResolver) ResponseWorker(has_paniced bool)

func (*TaskSingleLinkResolver) Work

func (t *TaskSingleLinkResolver) Work(r *Request)

TODO: make the parent_name in this function passed as an arg to NewTaskSingleLinkResolver instead of determining it from the result, as the current setup could create inconsistent behavior and is inherently incompatible with multi-type resources

type TaskUpdate

type TaskUpdate struct {
	Resource, Id string
	Output       chan chan bool
}

func NewTaskUpdate

func NewTaskUpdate(resource, id string) *TaskUpdate

func (*TaskUpdate) Cleanup

func (t *TaskUpdate) Cleanup(r *Request)

func (*TaskUpdate) ResponseWorker

func (t *TaskUpdate) ResponseWorker(has_paniced bool)

func (*TaskUpdate) Wait

func (t *TaskUpdate) Wait() bool

func (*TaskUpdate) Work

func (t *TaskUpdate) Work(r *Request)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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