resource

package
v0.2.14 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2024 License: BSD-3-Clause Imports: 7 Imported by: 10

Documentation

Index

Constants

View Source
const UriScheme = "res://"

Variables

This section is empty.

Functions

func GetTypeFromID

func GetTypeFromID(id string) (string, error)

func RegisterLoader

func RegisterLoader(resourceType string, loader Loader) error

RegisterManager registers a resource manager for the specified type

Types

type Config

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

type Loader

type Loader interface {
	LoadResource(config *Config) (*Resource, error)
}

func GetLoader

func GetLoader(resourceType string) Loader

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

func NewManager

func NewManager(resources map[string]*Resource) *Manager

func (*Manager) CleanupResources

func (m *Manager) CleanupResources()

func (*Manager) GetResource

func (m *Manager) GetResource(id string) *Resource

func (*Manager) ReconfigureResources added in v0.1.4

func (m *Manager) ReconfigureResources(resConfigs []*Config) (err error)

func (*Manager) SetResource added in v0.1.1

func (m *Manager) SetResource(id string, res *Resource)

type ReconfigurableResource added in v0.1.4

type ReconfigurableResource interface {
	Reconfigure(config *Config) error
}

type Resource

type Resource struct {
	// contains filtered or unexported fields
}

func New

func New(resType string, resObj interface{}) *Resource

func (*Resource) Object

func (r *Resource) Object() interface{}

func (*Resource) Type

func (r *Resource) Type() string

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