models

package
v0.0.0-...-ad732be Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2015 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	//CLIENT_TYPE_CONTROL makes fff
	ClientTypeControl = "control"
	ClientTypeDisplay = "display"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ChangedLayout

type ChangedLayout struct {
	ID    string `json:"id"`
	Token string `json:"token"`
}

CurrentLayout make a Current Layout

type Client

type Client struct {
	ID            string `json:"token"`
	Type          string `json:"type,omitempty"`
	CurrentLayout string `json:"currentlayout,omitempty"`
	IP            string `json:"ip,omitempty"`
	MAC           string `json:"mac,omitempty"`
}

Client 定义

type Clients

type Clients struct {
	Map map[string]Client
}

func (*Clients) AddClient

func (c *Clients) AddClient(s string) string

AddClient clientMap中增加client

func (*Clients) IsExistClient

func (c *Clients) IsExistClient(id string) bool

IsExistClient 判断clientMap中是否存在该key,参数key,返回值bool

func (*Clients) IsExistDisplay

func (c *Clients) IsExistDisplay() bool

func (*Clients) RemoveClient

func (c *Clients) RemoveClient(k string)

RemoveClient clientMap中移除client

type Error

type Error struct {
	Device    string `json:"device"`
	Message   string `json:"message"`
	DebugInfo string `json:"debuginfo"`
}

Error make server forwarding screen device debug info

type Grid

type Grid struct {
	ID       bson.ObjectId `json:"id" bson:"_id"`
	Left     int           `json:"left"`
	Top      int           `json:"top"`
	ZIndex   int           `json:"zindex"`
	Width    int           `json:"width"`
	Height   int           `json:"height"`
	Resource *Resource     `json:"resource" bson:"resource"`
}

Grid make a grid

type Layout

type Layout struct {
	ID    string          `json:"id"`
	Name  string          `json:"name"`
	Index int             `json:"index"`
	Grids map[string]Grid `json:"grids"`
}

Layout make a layout

func (*Layout) UpdateGrid

func (r *Layout) UpdateGrid(g *UpdateLayout)

type LayoutDO

type LayoutDO struct {
	ID    bson.ObjectId `bson:"_id"`
	Name  string        `bson:"name"`
	Index int           `bson:"index"`
	Grids []Grid        `bson:"grids"`
}

type Layouts

type Layouts struct {
	sync.RWMutex
	Store   map[string]Layout
	Created string
}

func (*Layouts) IsExistLayout

func (l *Layouts) IsExistLayout(k string) bool

func (*Layouts) Load

func (r *Layouts) Load(d *mgo.Database)

type Resource

type Resource struct {
	ID   bson.ObjectId `json:"id" bson:"_id"`
	Type resourceType  `json:"stype" bson:"stype"`
	URL  string        `json:"url" bson:"url"`
	Fix  bool          `json:"fix" bson:"fix"`
	Name string        `json:"name" bson:"name"`
}

Resource defines the basic information resource

type ResourceMap

type ResourceMap struct {
	sync.RWMutex
	Store   map[string]Resource
	Created string
}

ResourceMap make server's resource list

func (*ResourceMap) Load

func (r *ResourceMap) Load(d *mgo.Database)

Load 方法实现从MongoDB读取资源集合(collection name: resources)填充全局变量ResourceMap

type ResponseLayout

type ResponseLayout struct {
	Result bool   `json:"result"`
	Action string `json:"action"`
	ID     string `json:"id"`
	Token  string `json:"token"`
}

type Token

type Token struct {
	Token string `json:"token"`
}

type UpdateLayout

type UpdateLayout struct {
	ID    string          `json:"id,omitempty"`
	Grids map[string]Grid `json:"grids" bson:"grids"`
	Token string          `json:"token" bson:"token"`
}

Jump to

Keyboard shortcuts

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