container

package
v0.13.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsError

func IsError(data map[string]interface{}) bool

IsError checks whether the map is containing data for an error

Types

type Container

type Container struct {
	APIKey      string
	Endpoint    string
	AccessToken string
}

Container is a client-side view of remote Skygear functionality

func (*Container) GetAssetRequest

func (c *Container) GetAssetRequest(assetURL string) (response []byte, err error)

GetAssetRequest sends GET request to Skygear and get the corresponding asset.

func (*Container) MakeRequest

func (c *Container) MakeRequest(action string, request SkygearRequest) (response *SkygearResponse, err error)

MakeRequest sends request to Skygear

func (*Container) PrivateDatabaseID

func (c *Container) PrivateDatabaseID() string

PrivateDatabaseID returns ID of the current user's private database

func (*Container) PublicDatabaseID

func (c *Container) PublicDatabaseID() string

PublicDatabaseID returns ID of the public database

func (*Container) PutAssetRequest

func (c *Container) PutAssetRequest(filename, contentType string, body io.Reader) (response *SkygearResponse, err error)

PutAssetRequest sends asset PUT request to Skygear.

type Database

type Database struct {
	Container  *Container
	DatabaseID string
}

func (*Database) CreateColumn

func (d *Database) CreateColumn(recordType, columnName, columnDef string) error

func (*Database) DeleteColumn

func (d *Database) DeleteColumn(recordType, columnName string) error

func (*Database) DeleteRecord

func (d *Database) DeleteRecord(recordIDList []string) error

func (*Database) FetchAsset

func (d *Database) FetchAsset(assetURL string) (assetData []byte, err error)

func (*Database) FetchRecord

func (d *Database) FetchRecord(recordID string) (record *skyrecord.Record, err error)

func (*Database) FetchSchema

func (d *Database) FetchSchema() (map[string]interface{}, error)

func (*Database) QueryRecord

func (d *Database) QueryRecord(recordType string) ([]*skyrecord.Record, error)

func (*Database) RenameColumn

func (d *Database) RenameColumn(recordType, oldName, newName string) error

func (*Database) SaveAsset

func (d *Database) SaveAsset(path string) (assetID string, err error)

func (*Database) SaveRecord

func (d *Database) SaveRecord(record *skyrecord.Record) (err error)

type GenericRequest

type GenericRequest struct {
	Payload map[string]interface{}
}

GenericRequest implements payload for a generic request

func (*GenericRequest) MakePayload

func (r *GenericRequest) MakePayload() map[string]interface{}

MakePayload creates request payload for a generic request

type SkyDB

type SkyDB interface {
	FetchRecord(string) (*skyrecord.Record, error)
	QueryRecord(string) ([]*skyrecord.Record, error)
	SaveRecord(*skyrecord.Record) error
	DeleteRecord([]string) error
	FetchAsset(string) ([]byte, error)
	SaveAsset(string) (string, error)

	RenameColumn(string, string, string) error
	DeleteColumn(string, string) error
	CreateColumn(string, string, string) error
	FetchSchema() (map[string]interface{}, error)
}

type SkygearError

type SkygearError struct {
	ID      string
	Message string
	Code    int
	Type    string
}

SkygearError encapsulates data of an Skygear response

func MakeError

func MakeError(data map[string]interface{}) SkygearError

MakeError creates an SkygearError

func (SkygearError) Error

func (e SkygearError) Error() string

type SkygearRequest

type SkygearRequest interface {
	// MakePayload creates map structure of the payload for sending
	// to remove server
	MakePayload() map[string]interface{}
}

SkygearRequest encapsulates payload for making Skygear requests

type SkygearResponse

type SkygearResponse struct {
	Payload map[string]interface{}
}

SkygearResponse encapsulates payload received from Skygear

func (*SkygearResponse) Error

func (r *SkygearResponse) Error() *SkygearError

Error returns error in the response if any

func (*SkygearResponse) IsError

func (r *SkygearResponse) IsError() bool

IsError returns if response is an error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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