models

package
v0.0.0-...-80e77ef Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2015 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

domain model

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Domain

type Domain struct {
	ID      bson.ObjectId  `bson:"_id,omitempty" json:"id"`
	Name    string         `bson:"name"          json:"name"`
	URL     string         `bson:"url"           json:"url"`
	Setting *DomainSetting `bson:"settings"      json:"settigns"`
}

func NewDomain

func NewDomain(Name, URL string, Setting *DomainSetting) Domain

Create a new Domain instance

func (*Domain) Save

func (d *Domain) Save(DB *mgo.Database) error

func (*Domain) Validate

func (d *Domain) Validate() bool

type DomainSetting

type DomainSetting struct {
	Interval uint8 `bson:"interval"      json:"interval"` // Interval for each ping in seconds. min: 60s max: 180s
	Retry    uint8 `bson:"retry"         json:"retry"`    // Amount times for retry a ping to domain. min: 1 max: 5
	Timeout  uint8 `bson:"timeout"       json:"timeout"`  // Timeout for each retry ping. min: 5s max: 20s
}

func NewDomainSetting

func NewDomainSetting(Interval, Retry, Timeout uint8) (DomainSetting, error)

Create a new DomainSetting instance

func (*DomainSetting) Validate

func (ds *DomainSetting) Validate() bool

Check if DomainSetting instance accomplish all restrictions.

type EventDomain

type EventDomain struct {
	DomainID    string    `bson:"domain_id"`
	TypeID      string    `bson:"type_id"`
	CreatedAt   time.Time `bson:"created_at"`
	Description string    `bson:"description"`
}

type EventServices

type EventServices struct {
	DaemonID    string    `bson:"daemon_id"`
	TypeID      string    `bson:"type_id"`
	CreatedAt   time.Time `bson:"created_at"`
	Description string    `bson:"description"`
	Environment string    `bson:"env"` // Shoul be a JSON field with all env data where run the daemon

}

For the future

type Type

type Type struct {
	Name      string `bson:"name"`
	Shortname string `bson:"short_name"`
	Color     string `bson:"color"` // Show a color for the type of event
}

Jump to

Keyboard shortcuts

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