Documentation ¶
Overview ¶
Package flatdata represents Go implementation for Flatdata
Index ¶
Constants ¶
const ( // ErrorInvalidResource returns in case of size of resource is smaller than minimal ErrorInvalidResource = "invalid flatdata resource" // ErrorCantAccessResource returns if resource wasn't been memory-mapped ErrorCantAccessResource = "can't open flatdata resource" // ErrorCantOpenSchemaForResource returns if schema for resource wasn't open ErrorCantOpenSchemaForResource = "can't open schema for resource" // ErrorSchemaEmpty returns in case when schema is empty ErrorSchemaEmpty = "schema for resource is empty" // ErrorSchemaDidntMatch returns if provided schema is not equal to schema in generated sources ErrorSchemaDidntMatch = "schemas didn't match" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type FileResourceStorage ¶
type FileResourceStorage struct {
// contains filtered or unexported fields
}
FileResourceStorage implements ResourceStorage interface for memory-mapped file
func NewFileResourceStorage ¶
func NewFileResourceStorage(path string) *FileResourceStorage
NewFileResourceStorage - constructor for FileResourceStorage
func (*FileResourceStorage) GetBasePath ¶
func (r *FileResourceStorage) GetBasePath() string
GetBasePath returns base path to opened archive
func (*FileResourceStorage) GetMemoryDescriptor ¶
func (r *FileResourceStorage) GetMemoryDescriptor(name string) (MemoryDescriptor, string, error)
GetMemoryDescriptor returns memory descriptor for specified resource
type InMemoryResourceStorage ¶
type InMemoryResourceStorage struct { Descriptors map[string]MemoryDescriptor Schemas map[string]string }
InMemoryResourceStorage implements ResourceStorage interface for working with in-memory data
func (*InMemoryResourceStorage) GetBasePath ¶
func (r *InMemoryResourceStorage) GetBasePath() string
GetBasePath returns empty string in case of InMemoryResourceStorage
func (*InMemoryResourceStorage) GetMemoryDescriptor ¶
func (r *InMemoryResourceStorage) GetMemoryDescriptor(name string) (MemoryDescriptor, string, error)
GetMemoryDescriptor returns memory descriptor for specified resource
type MemoryDescriptor ¶
MemoryDescriptor represents internal low level data access
type ResourceStorage ¶
type ResourceStorage interface { GetMemoryDescriptor(name string) (MemoryDescriptor, string, error) GetBasePath() string }
ResourceStorage represents abstraction for getting resource handle
type TestMemoryDescriptor ¶
type TestMemoryDescriptor struct {
Array []byte
}
TestMemoryDescriptor implements MemoryDescriptor interface with reading date from []byte for internal usage
func (*TestMemoryDescriptor) At ¶
func (b *TestMemoryDescriptor) At(i int) byte
At return byte on position i
func (*TestMemoryDescriptor) Close ¶
func (b *TestMemoryDescriptor) Close() error
Close should close memory descriptor
func (*TestMemoryDescriptor) Len ¶
func (b *TestMemoryDescriptor) Len() int
Len returns length of internal byte array