sky

package module
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2013 License: MIT Imports: 8 Imported by: 0

README

sky.go

The official Go client for the Sky database.

Documentation

Index

Constants

View Source
const (
	String  = "string"
	Integer = "integer"
	Float   = "float"
	Boolean = "boolean"
	Factor  = "factor"
)
View Source
const (
	Replace = "replace"
	Merge   = "merge"
)
View Source
const (
	DefaultPort = 8585
)
View Source
const (
	Version = "0.3.0"
)

Variables

This section is empty.

Functions

func FormatTimestamp

func FormatTimestamp(timestamp time.Time) string

Formats a time into ISO8601 format with fractional seconds.

func ParseTimestamp

func ParseTimestamp(str string) (time.Time, error)

Parses an ISO8601 timestamp with or without fractional seconds.

Types

type Client

type Client struct {
	Host string
	Port int
	// contains filtered or unexported fields
}

A Client is what communicates command to the server.

func NewClient

func NewClient(host string) *Client

func (*Client) CreateTable

func (c *Client) CreateTable(table *Table) error

Creates a table on the server.

func (*Client) DeleteTable

func (c *Client) DeleteTable(table *Table) error

Deletes a table on the server.

func (*Client) GetTable

func (c *Client) GetTable(name string) (*Table, error)

Retrieves a single table from the server.

func (*Client) GetTables

func (c *Client) GetTables() ([]*Table, error)

Retrieves a list of all tables on the server.

func (*Client) Ping

func (c *Client) Ping() bool

Checks if the server is currently running and available.

type Error

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

An error generated from the Sky server.

func NewError

func NewError(message string) *Error

NewError creates a new Sky error object.

func (*Error) Error

func (e *Error) Error() string

The error message.

type Event

type Event struct {
	Timestamp time.Time
	Data      map[string]interface{}
}

An Event is a timestamped hash of data.

func NewEvent

func NewEvent(timestamp time.Time, data map[string]interface{}) *Event

func (*Event) Deserialize

func (e *Event) Deserialize(obj map[string]interface{}) error

Decodes an event from an untyped map.

func (*Event) Serialize

func (e *Event) Serialize() map[string]interface{}

Encodes an event into an untyped map.

type Property

type Property struct {
	Id        int    `json:"id"`
	Name      string `json:"name"`
	Transient bool   `json:"transient"`
	DataType  string `json:"dataType"`
}

A Property is part of the table's schema.

func NewProperty

func NewProperty(name string, transient bool, dataType string) *Property

type Table

type Table struct {
	Name string `json:"name"`
	// contains filtered or unexported fields
}

A Table is a container for objects and events.

func NewTable

func NewTable(name string, client *Client) *Table

func (*Table) AddEvent

func (t *Table) AddEvent(objectId string, event *Event, method string) error

Adds an event to an object.

func (*Table) CreateProperty

func (t *Table) CreateProperty(property *Property) error

Creates a property on the table.

func (*Table) DeleteEvent

func (t *Table) DeleteEvent(objectId string, event *Event) error

Deletes an event on the table.

func (*Table) DeleteProperty

func (t *Table) DeleteProperty(property *Property) error

Deletes a property on the table.

func (*Table) GetEvent

func (t *Table) GetEvent(objectId string, timestamp time.Time) (*Event, error)

Retrieves a single event for an object.

func (*Table) GetEvents

func (t *Table) GetEvents(objectId string) ([]*Event, error)

Retrieves a list of all events for an object.

func (*Table) GetProperties

func (t *Table) GetProperties() ([]*Property, error)

Retrieves a list of all properties on the table.

func (*Table) GetProperty

func (t *Table) GetProperty(name string) (*Property, error)

Retrieves a single property from the server.

func (*Table) RawQuery

func (t *Table) RawQuery(q map[string]interface{}) (map[string]interface{}, error)

Executes a raw query on the table.

func (*Table) UpdateProperty

func (t *Table) UpdateProperty(name string, property *Property) error

Updates a property on the table.

Jump to

Keyboard shortcuts

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