resource

package
v0.2.7 Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2020 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Interface

type Interface interface {
	Transform(model ItemInterface, params ...ParamInterface) Interface
}

func TransformCollection

func TransformCollection(collection interface{}, resource Interface) []Interface

func TransformCollectionWithCallback

func TransformCollectionWithCallback(collection interface{}, resource Interface, callbackFunc func(model ParamInterface) ParamsInterface) []Interface

type ItemInterface

type ItemInterface interface{}

type PaginationLinksResource

type PaginationLinksResource struct {
	First *string `json:"first"`
	Last  *string `json:"last"`
	Prev  *string `json:"prev"`
	Next  *string `json:"next"`
}

type PaginationMetaResource

type PaginationMetaResource struct {
	CurrentPage int                    `json:"current_page"`
	LastPage    int                    `json:"last_page"`
	Path        string                 `json:"path"`
	PerPage     int                    `json:"per_page"`
	Total       int                    `json:"total"`
	Additional  map[string]interface{} `json:"additional,omitempty"`
}

type PaginationResource

type PaginationResource struct {
	Data  []Interface             `json:"data"`
	Links PaginationLinksResource `json:"links"`
	Meta  PaginationMetaResource  `json:"meta"`
}

func TransformPaginatedCollection

func TransformPaginatedCollection(collection interface{}, resource Interface, pagination tools.Pagination) PaginationResource

func TransformPaginatedCollectionWithAdditionalFields

func TransformPaginatedCollectionWithAdditionalFields(collection interface{}, resource Interface, pagination tools.Pagination, additional map[string]interface{}) PaginationResource

type ParamInterface

type ParamInterface interface{}

type ParamsInterface

type ParamsInterface []ParamInterface

Jump to

Keyboard shortcuts

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