module_store

package
v0.0.0-...-6dc645d Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2024 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MIME_TEXT = "text/plain"
	MIME_CSV  = "text/csv"
	MIME_XLSX = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
)

Variables

This section is empty.

Functions

func UnMarshalStore

func UnMarshalStore(ctx context.Context, b []byte, msi ModuleStoreI) error

Types

type FileDownloadRequest

type FileDownloadRequest struct {
	FileName        string                                       `json:"file_name" eru:"required"`
	FolderPath      string                                       `json:"folder_path" eru:"required"`
	InnerFileNames  []string                                     `json:"inner_file_names" eru:"required"`
	CsvAsJson       bool                                         `json:"csv_as_json"`
	CsvDelimited    int32                                        `json:"csv_delimited"`
	ExcelAsJson     bool                                         `json:"excel_as_json"`
	ExcelSheets     map[string]map[string]eru_reads.FileReadData `json:"excel_sheets"`
	LowerCaseHeader bool                                         `json:"lower_case_header"`
	Mime_Limit      uint32                                       `json:"mime_limit"`
}

type FileObj

type FileObj struct {
	FileType string      `json:"file_type"`
	File     interface{} `json:"file"`
}

type ModuleDbStore

type ModuleDbStore struct {
	store.DbStore
	ModuleStore
}

type ModuleFileStore

type ModuleFileStore struct {
	store.FileStore
	ModuleStore
}

type ModuleStore

type ModuleStore struct {
	Projects map[string]*file_model.Project `json:"projects"` //ProjectId is the key
}

func (*ModuleStore) DownloadFile

func (ms *ModuleStore) DownloadFile(ctx context.Context, projectId string, storageName string, fileDownloadRequest FileDownloadRequest, s ModuleStoreI) (file []byte, mimeType string, err error)

func (*ModuleStore) DownloadFileAsJson

func (ms *ModuleStore) DownloadFileAsJson(ctx context.Context, projectId string, storageName string, fileDownloadRequest FileDownloadRequest, s ModuleStoreI) (jsonData []map[string]interface{}, err error)

func (*ModuleStore) DownloadFileB64

func (ms *ModuleStore) DownloadFileB64(ctx context.Context, projectId string, storageName string, fileDownloadRequest FileDownloadRequest, s ModuleStoreI) (fileB64 string, mimeType string, err error)

func (*ModuleStore) DownloadFileUnzip

func (ms *ModuleStore) DownloadFileUnzip(ctx context.Context, projectId string, storageName string, fileDownloadRequest FileDownloadRequest, s ModuleStoreI) (files map[string]FileObj, err error)

func (*ModuleStore) GenerateAesKey

func (ms *ModuleStore) GenerateAesKey(ctx context.Context, projectId string, keyName string, bits int, overwrite bool, realStore ModuleStoreI) (aesKey eruaes.AesKey, err error)

func (*ModuleStore) GenerateRsaKeyPair

func (ms *ModuleStore) GenerateRsaKeyPair(ctx context.Context, projectId string, keyPairName string, bits int, overwrite bool, realStore ModuleStoreI) (rsaKeyPair erursa.RsaKeyPair, err error)

func (*ModuleStore) GetProjectConfig

func (ms *ModuleStore) GetProjectConfig(ctx context.Context, projectId string) (*file_model.Project, error)

func (*ModuleStore) GetProjectList

func (ms *ModuleStore) GetProjectList(ctx context.Context) []map[string]interface{}

func (*ModuleStore) GetStorageClone

func (ms *ModuleStore) GetStorageClone(ctx context.Context, projectId string, storageName string, s ModuleStoreI) (storageObjClone storage.StorageI, prj *file_model.Project, err error)

func (*ModuleStore) RemoveProject

func (ms *ModuleStore) RemoveProject(ctx context.Context, projectId string, realStore ModuleStoreI) error

func (*ModuleStore) RemoveStorage

func (ms *ModuleStore) RemoveStorage(ctx context.Context, storageName string, projectId string, realStore ModuleStoreI) error

func (*ModuleStore) SaveProject

func (ms *ModuleStore) SaveProject(ctx context.Context, projectId string, realStore ModuleStoreI, persist bool) error

func (*ModuleStore) SaveStorage

func (ms *ModuleStore) SaveStorage(ctx context.Context, storageObj storage.StorageI, projectId string, realStore ModuleStoreI, persist bool) error

func (*ModuleStore) UploadFile

func (ms *ModuleStore) UploadFile(ctx context.Context, projectId string, storageName string, file multipart.File, header *multipart.FileHeader, docType string, folderPath string, s ModuleStoreI) (docId string, err error)

func (*ModuleStore) UploadFileB64

func (ms *ModuleStore) UploadFileB64(ctx context.Context, projectId string, storageName string, file []byte, fileName string, docType string, folderPath string, s ModuleStoreI) (docId string, err error)

func (*ModuleStore) UploadFileFromUrl

func (ms *ModuleStore) UploadFileFromUrl(ctx context.Context, projectId string, storageName string, url string, fileName string, docType string, folderPath string, fileType string, s ModuleStoreI) (docId string, err error)

type ModuleStoreI

type ModuleStoreI interface {
	store.StoreI
	SaveProject(ctx context.Context, projectId string, realStore ModuleStoreI, persist bool) error
	RemoveProject(ctx context.Context, projectId string, realStore ModuleStoreI) error
	GetProjectConfig(ctx context.Context, projectId string) (*file_model.Project, error)
	GetProjectList(ctx context.Context) []map[string]interface{}
	SaveStorage(ctx context.Context, storageObj storage.StorageI, projectId string, realStore ModuleStoreI, persist bool) error
	RemoveStorage(ctx context.Context, storageName string, projectId string, realStore ModuleStoreI) error
	GenerateRsaKeyPair(ctx context.Context, projectId string, keyPairName string, bits int, overwrite bool, realStore ModuleStoreI) (rsaKeyPair erursa.RsaKeyPair, err error)
	GenerateAesKey(ctx context.Context, projectId string, keyPairName string, bits int, overwrite bool, realStore ModuleStoreI) (aesKey eruaes.AesKey, err error)
	UploadFile(ctx context.Context, projectId string, storageName string, file multipart.File, header *multipart.FileHeader, docType string, fodlerPath string, s ModuleStoreI) (docId string, err error)
	UploadFileB64(ctx context.Context, projectId string, storageName string, file []byte, fileName string, docType string, fodlerPath string, s ModuleStoreI) (docId string, err error)
	UploadFileFromUrl(ctx context.Context, projectId string, storageName string, url string, fileName string, docType string, fodlerPath string, fileType string, s ModuleStoreI) (docId string, err error)
	DownloadFile(ctx context.Context, projectId string, storageName string, fileDownloadRequest FileDownloadRequest, s ModuleStoreI) (file []byte, mimeType string, err error)
	DownloadFileAsJson(ctx context.Context, projectId string, storageName string, fileDownloadRequest FileDownloadRequest, s ModuleStoreI) (jsonData []map[string]interface{}, err error)
	DownloadFileB64(ctx context.Context, projectId string, storageName string, fileDownloadRequest FileDownloadRequest, s ModuleStoreI) (fileB64 string, mimeType string, err error)
	DownloadFileUnzip(ctx context.Context, projectId string, storageName string, fileDownloadRequest FileDownloadRequest, s ModuleStoreI) (files map[string]FileObj, err error)
}

func GetStore

func GetStore(storeType string) ModuleStoreI

type StoreHolder

type StoreHolder struct {
	Store ModuleStoreI
}

Jump to

Keyboard shortcuts

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