context

package
v0.0.0-...-f3efba2 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2020 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DoStoreFile

func DoStoreFile(ctx *Context, req *StoreRequest) (string, error)

func InitFiles

func InitFiles(ctx *Context, filepath string)

Types

type Context

type Context struct {
	// contains filtered or unexported fields
}

Context provides access to the data store.

func Open

func Open(path string) (*Context, error)

Open the context using path as the data store location.

func (*Context) Close

func (c *Context) Close() error

Close the resources associated with this context.

func (*Context) Del

func (c *Context) Del(key string) error

Del removes an existing file from the data store.

func (*Context) Get

func (c *Context) Get(name string) (*File, error)

Get retreives a file from the data store.

func (*Context) GetAll

func (c *Context) GetAll() (map[string]File, error)

GetAll gets everything in the db to dump it out for backup purposes

func (*Context) Put

func (c *Context) Put(key string, rt *File) error

Put stores a new file in the data store.

type File

type File struct {
	Content []byte    `json:"content"`
	Time    time.Time `json:"time"`
}

File is the value part of a shortcut.

type Flag

type Flag struct {
	Name  string `json:"name"`
	Value string `json:"value"`
}

type StoreRequest

type StoreRequest struct {
	FileName string `json:"filename"`
	Content  []byte `json:"content"`
	Flags    []Flag `json:"flags"`
	Service  string `json:"service"`
}

Jump to

Keyboard shortcuts

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