filetype

package
v1.2.15 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2024 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// IndexKeyValSeperator -
	IndexKeyValSeperator = "="
	// FileType - represents key for type of file. Used whenever we need to set file type field in json
	FileType = "fileType"
)

Variables

View Source
var ErrNoDataFound = errors.New("No data found")

ErrNoDataFound - ErrNoDataFound

Functions

func CreateIndexJSON

func CreateIndexJSON(indexFields []InFileIndexField, rs *gjson.Result) (string, error)

func InitializeWithHeaderUsingFp

func InitializeWithHeaderUsingFp(f *os.File) error

Types

type AppendFile

type AppendFile struct {
	FilePath     string
	Fp           *os.File
	IsLazyEnable bool
	// contains filtered or unexported fields
}

func NewAppendFile

func NewAppendFile(filePath string, securityProvider securityprovider.SecurityProvider) (*AppendFile, error)

func (*AppendFile) Close

func (af *AppendFile) Close() error

func (*AppendFile) Write

func (af *AppendFile) Write(rs *gjson.Result) (err error)

type InFileIndex

type InFileIndex struct {
	FileType    string             `json:"fileType"`
	IndexFields []InFileIndexField `json:"indexFields"`
}

type InFileIndexField

type InFileIndexField struct {
	FieldName string `json:"fieldName"`
	Query     string `json:"query"`
}

type PackFile

type PackFile struct {
	FilePath         string
	InfileIndexRows  *gjson.Result
	Fp               *os.File
	SecurityProvider securityprovider.SecurityProvider
	// contains filtered or unexported fields
}

func NewPackFile

func NewPackFile(filePath string, infileIndexSchemaMap map[string]InFileIndex, securityProvider securityprovider.SecurityProvider) (*PackFile, error)

func (*PackFile) Close

func (p *PackFile) Close() error

func (*PackFile) Read

func (p *PackFile) Read(queries []string, data *gjson.Result) (string, error)

func (*PackFile) ReadMedia

func (p *PackFile) ReadMedia(recordID string) ([]byte, *gjson.Result, error)

func (*PackFile) ReadMediaByQuery

func (p *PackFile) ReadMediaByQuery(inFileIndexQueries []string) (map[string][]byte, map[string]gjson.Result, error)

func (*PackFile) Remove

func (p *PackFile) Remove(queries []string) (recordsDeletedCnt int, err error)

func (*PackFile) RemoveMedia

func (p *PackFile) RemoveMedia(recordID string) error

func (*PackFile) Reorg

func (p *PackFile) Reorg() error

func (*PackFile) Update

func (p *PackFile) Update(queries []string, rs *gjson.Result) (gjson.Result, error)

func (*PackFile) UpdateMedia

func (p *PackFile) UpdateMedia(recordID string, mediaData []byte, rs *gjson.Result) (err error)

func (*PackFile) UpsertMedia

func (p *PackFile) UpsertMedia(recordID string, mediaData []byte, rs *gjson.Result) (string, error)

func (*PackFile) Write

func (p *PackFile) Write(rs *gjson.Result) (err error)

func (*PackFile) WriteMedia

func (p *PackFile) WriteMedia(mediaData []byte, rs *gjson.Result) (recordID string, err error)

type SimpleFile

type SimpleFile struct {
	FilePath     string
	Fp           *os.File
	IsLazyEnable bool
	// contains filtered or unexported fields
}

func NewSimpleFile

func NewSimpleFile(filePath string, securityProvider securityprovider.SecurityProvider) (*SimpleFile, error)

func (*SimpleFile) Close

func (s *SimpleFile) Close() error

func (*SimpleFile) Read

func (s *SimpleFile) Read(data *gjson.Result) ([]byte, error)

func (*SimpleFile) Remove

func (s *SimpleFile) Remove() error

func (*SimpleFile) Update

func (s *SimpleFile) Update(rs *gjson.Result) (gjson.Result, error)

func (*SimpleFile) Write

func (s *SimpleFile) Write(rs *gjson.Result) (err error)

Jump to

Keyboard shortcuts

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