resource

package
v0.0.0-...-0a944fc Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2023 License: BSD-3-Clause Imports: 7 Imported by: 0

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

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

func (*Manager) SetResource

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

type ReconfigurableResource

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