resource

package
v0.0.0-rc9 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2024 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package resource provides integration with RESOURCE and RESOURCE_FILES macros.

Use RESOURCE macro to "link" file into the library or executable.

RESOURCE(my_file.txt some_key)

And then retrieve file content in the runtime.

blob := resource.Get("some_key")

Warning: Excessive consumption of resource leads to obesity.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Get

func Get(key string) []byte

Get returns content of the file registered by the given key.

If no file was registered for the given key, nil slice is returned.

User should take care, to avoid mutating returned slice.

func InternalRegister

func InternalRegister(key string, blob []byte)

InternalRegister is private API used by generated code.

func Keys

func Keys() []string

Keys returns sorted keys of all registered resources inside the binary

func MustGet

func MustGet(key string) []byte

MustGet is like Get, but panics when associated resource is not defined.

Types

This section is empty.

Jump to

Keyboard shortcuts

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