resource

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2026 License: MIT Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Collection

func Collection(items []Resource) []map[string]any

Collection maps a slice of resources to JSON.

Types

type Resource

type Resource interface {
	ToJSON() map[string]any
}

Resource transforms a model to API response format (Laravel API Resources). Implement ToJSON to control which fields are exposed.

type ResourceFunc

type ResourceFunc func() map[string]any

ResourceFunc adapts a function to Resource.

func (ResourceFunc) ToJSON

func (f ResourceFunc) ToJSON() map[string]any

Jump to

Keyboard shortcuts

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