gobroem

package
v0.0.0-...-31f36ab Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2018 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Asset

func Asset(name string) ([]byte, error)

Asset loads and returns the asset for the given name. It returns an error if the asset could not be found or could not be loaded.

func AssetDir

func AssetDir(name string) ([]string, error)

AssetDir returns the file names below a certain directory embedded in the file by go-bindata. For example if you run go-bindata on data/... and data contains the following hierarchy:

data/
  foo.txt
  img/
    a.png
    b.png

then AssetDir("data") would return []string{"foo.txt", "img"} AssetDir("data/img") would return []string{"a.png", "b.png"} AssetDir("foo.txt") and AssetDir("notexist") would return an error AssetDir("") will return []string{"data"}.

func AssetInfo

func AssetInfo(name string) (os.FileInfo, error)

AssetInfo loads and returns the asset info for the given name. It returns an error if the asset could not be found or could not be loaded.

func AssetNames

func AssetNames() []string

AssetNames returns the names of the assets.

func MustAsset

func MustAsset(name string) []byte

MustAsset is like Asset but panics when Asset would return an error. It simplifies safe initialization of global variables.

func RestoreAsset

func RestoreAsset(dir, name string) error

RestoreAsset restores an asset under the given directory

func RestoreAssets

func RestoreAssets(dir, name string) error

RestoreAssets restores an asset under the given directory recursively

func SliceScan

func SliceScan(r *sql.Rows) ([]interface{}, error)

SliceScan a row, returning a []interface{} with values similar to MapScan. This function is primarily intended for use where the number of columns is not known. Because you can pass an []interface{} directly to Scan, it's recommended that you do that as it will not have to allocate new slices per row.

Types

type API

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

API ...

func NewAPI

func NewAPI(dbFile string) (*API, error)

NewAPI initializes the API controller with a DB file.

func NewAPIFromDB

func NewAPIFromDB(db *sql.DB) (*API, error)

NewAPIFromDB initializes the API controller with a DB.

func (*API) Handler

func (a *API) Handler(browserRoot string, staticRoot string) http.Handler

Handler ...

func (*API) Info

func (a *API) Info(w http.ResponseWriter, req *http.Request)

Info ...

func (*API) Query

func (a *API) Query(w http.ResponseWriter, req *http.Request)

Query ...

func (*API) Table

func (a *API) Table(w http.ResponseWriter, req *http.Request)

Table ...

func (*API) TableIndexes

func (a *API) TableIndexes(w http.ResponseWriter, req *http.Request)

TableIndexes ...

func (*API) TableInfo

func (a *API) TableInfo(w http.ResponseWriter, req *http.Request)

TableInfo ...

func (*API) TableSQL

func (a *API) TableSQL(w http.ResponseWriter, req *http.Request)

TableSQL ...

func (*API) Tables

func (a *API) Tables(w http.ResponseWriter, req *http.Request)

Tables ...

type AssetDirectory

type AssetDirectory struct {
	AssetFile
	ChildrenRead int
	Children     []os.FileInfo
}

AssetDirectory implements http.File interface for a directory

func NewAssetDirectory

func NewAssetDirectory(name string, children []string, fs *AssetFS) *AssetDirectory

NewAssetDirectory ...

func (*AssetDirectory) Readdir

func (f *AssetDirectory) Readdir(count int) ([]os.FileInfo, error)

Readdir ...

func (*AssetDirectory) Stat

func (f *AssetDirectory) Stat() (os.FileInfo, error)

Stat ...

type AssetFS

type AssetFS struct {
	AssetDir func(name string) ([]string, error)
	Asset    func(name string) ([]byte, error)
	Prefix   string
}

AssetFS ...

func (*AssetFS) Open

func (fs *AssetFS) Open(name string) (http.File, error)

Open ...

type AssetFile

type AssetFile struct {
	*bytes.Reader
	io.Closer
	FakeFile
}

AssetFile implements http.File interface for a no-directory file with content

func NewAssetFile

func NewAssetFile(name string, content []byte) *AssetFile

NewAssetFile ...

func (*AssetFile) Readdir

func (f *AssetFile) Readdir(count int) ([]os.FileInfo, error)

Readdir ...

func (*AssetFile) Size

func (f *AssetFile) Size() int64

Size ...

func (*AssetFile) Stat

func (f *AssetFile) Stat() (os.FileInfo, error)

Stat ...

type FakeFile

type FakeFile struct {
	// Path is the path of this file
	Path string
	// Dir marks of the path is a directory
	Dir bool
	// Len is the length of the fake file, zero if it is a directory
	Len int64
}

FakeFile implements os.FileInfo interface for a given path and size

func (*FakeFile) IsDir

func (f *FakeFile) IsDir() bool

IsDir ...

func (*FakeFile) ModTime

func (f *FakeFile) ModTime() time.Time

ModTime ...

func (*FakeFile) Mode

func (f *FakeFile) Mode() os.FileMode

Mode ...

func (*FakeFile) Name

func (f *FakeFile) Name() string

Name ...

func (*FakeFile) Size

func (f *FakeFile) Size() int64

Size ...

func (*FakeFile) Sys

func (f *FakeFile) Sys() interface{}

Sys ...

Jump to

Keyboard shortcuts

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