resource

package
v0.5.9 Latest Latest
Warning

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

Go to latest
Published: May 22, 2023 License: BSD-3-Clause Imports: 3 Imported by: 14 modules, 16 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Get

func Get(id string) (interface{}, error)

Get gets the specified resource, id format is {type}:{id}"

func GetTypeFromID

func GetTypeFromID(id string) (string, error)

func Load

func Load(config *Config) error

Load specified resource into its corresponding Resource Manager

func RegisterManager

func RegisterManager(resourceType string, manager Manager) error

RegisterManager registers a resource manager for the specified type

Types

type Config

type Config struct {
	ID         string          `json:"id"`
	Compressed bool            `json:"compressed"`
	Data       json.RawMessage `json:"data"`
}

type Manager

type Manager interface {
	// LoadResources tells the manager to load the specified resource set
	LoadResource(config *Config) error

	// GetResource get the resource that corresponds to the specified id
	GetResource(id string) interface{}
}

ResourceManager interface

func GetManager

func GetManager(resourceType string) Manager

GetManager gets the manager for the specified resource type

type ResourcesConfig

type ResourcesConfig struct {
	Resources []*Config `json:"resources"`
}

Jump to

Keyboard shortcuts

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