gobblr

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2023 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AllowedFileTypes = map[FileType]struct{}{
	FileTypeJSON: {},
	FileTypeJS:   {},
}

Functions

func Serve

func Serve(dataPath string, db drivers.Driver, retries uint64, port int) error

Types

type File

type File struct {
	Path      string
	TableName string
	Type      FileType
}

func FindFiles

func FindFiles(dataPath string) ([]File, error)

func (*File) LoadFile

func (f *File) LoadFile() (jsonData *FileData, err error)

type FileData

type FileData struct {
	Meta MetaData                 `json:"meta"`
	Data []map[string]interface{} `json:"data"`
}

type FileType

type FileType string
const (
	FileTypeJSON FileType = "json"
	FileTypeJS   FileType = "js"
)

type Inserted

type Inserted struct {
	Table string `json:"table"`
	Count int    `json:"count"`
}

func Execute

func Execute(dataPath string, db drivers.Driver, retries uint64) ([]Inserted, error)

type MetaData

type MetaData struct {
	Created    bool   `json:"created"`
	CreatedKey string `json:"createdKey"`
	Updated    bool   `json:"updated"`
	UpdatedKey string `json:"updatedKey"`
}

Jump to

Keyboard shortcuts

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