models

package
v0.4.3-0...-fd7f253 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2018 License: GPL-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	Id       bson.ObjectId `bson:"_id"      json:"_id,omitempty"`
	Ip       string        `bson:"ip"       json:"ip"`
	System   string        `bson:"system"   json:"system"`
	Hostname string        `bson:"hostname" json:"hostname"`
	Type     string        `bson:"type"     json:"type"`
	Uptime   time.Time     `bson:"uptime"   json:"uptime,omitempty"`
	// contains filtered or unexported fields
}

func NewClient

func NewClient() Client

func (*Client) Aggregate

func (bmodel *Client) Aggregate(querylist ...bson.M) []bson.M

Aggregate db.aggregate

func (*Client) Count

func (bmodel *Client) Count(query bson.M) int

Count count the file result number

func (*Client) CountSubList

func (bmodel *Client) CountSubList(query bson.M, listkey string) int

CountSubList count the list item in one collection

func (*Client) Distinct

func (bmodel *Client) Distinct(query bson.M, key string) []interface{}

Distinct return only one key in find result

func (*Client) Find

func (bmodel *Client) Find(query bson.M, start int, limit int, sort ...string) []bson.M

Find base find function

func (*Client) FindAll

func (bmodel *Client) FindAll(query bson.M) []bson.M

FindAll as name

func (*Client) FindByID

func (bmodel *Client) FindByID(id bson.ObjectId) bson.M

FindByID as name

func (*Client) FindOne

func (bmodel *Client) FindOne(query bson.M) bson.M

FindOne get one result

func (*Client) GetAll

func (bmodel *Client) GetAll() []bson.M

GetAll get all document in collection

func (*Client) GetPieces

func (bmodel *Client) GetPieces(q bson.M, start int, limit int) []bson.M

GetPieces limit and start in find

func (*Client) GetSortedTop

func (bmodel *Client) GetSortedTop(q bson.M, start int, limit int, sort ...string) []bson.M

GetSortedTop find for sort

func (*Client) InsertMany

func (bmodel *Client) InsertMany(datalist []interface{}) error

InsertMany insert a list to mongo

func (*Client) InsertOne

func (bmodel *Client) InsertOne(data bson.M) bool

InsertOne as name

func (*Client) Remove

func (bmodel *Client) Remove(query bson.M) error

Remove remove all conform to query, but error will stop TODO it is hardly to supported continue_on_error

func (*Client) UpdateByID

func (bmodel *Client) UpdateByID(id interface{}, data interface{}) error

UpdateByID as name

type CodeInfo

type CodeInfo struct {
	Status int               `json:"status"`
	Msg    string            `json:"msg"`
	Data   map[string]string `json:"data"`
}

func NewErrorInfo

func NewErrorInfo(info string) *CodeInfo

func NewNormalInfo

func NewNormalInfo(info string) *CodeInfo

type Config

type Config struct {
	Id   bson.ObjectId `bson:"_id"      json:"_id,omitempty"`
	Type string        `bson:"type"     json:"type"`
	Dic  interface{}   `bson:"dic"      json:"dic"`
	// contains filtered or unexported fields
}

func NewConfig

func NewConfig() Config

func (*Config) AddOne

func (c *Config) AddOne(id string, key string, value string) bool

func (*Config) Aggregate

func (bmodel *Config) Aggregate(querylist ...bson.M) []bson.M

Aggregate db.aggregate

func (*Config) Count

func (bmodel *Config) Count(query bson.M) int

Count count the file result number

func (*Config) CountSubList

func (bmodel *Config) CountSubList(query bson.M, listkey string) int

CountSubList count the list item in one collection

func (*Config) DelOne

func (c *Config) DelOne(id string, key string, value string) bool

func (*Config) Distinct

func (bmodel *Config) Distinct(query bson.M, key string) []interface{}

Distinct return only one key in find result

func (*Config) EditByID

func (c *Config) EditByID(id string, key string, value string) bool

func (*Config) Find

func (bmodel *Config) Find(query bson.M, start int, limit int, sort ...string) []bson.M

Find base find function

func (*Config) FindAll

func (bmodel *Config) FindAll(query bson.M) []bson.M

FindAll as name

func (*Config) FindByID

func (bmodel *Config) FindByID(id bson.ObjectId) bson.M

FindByID as name

func (*Config) FindOne

func (c *Config) FindOne(selector bson.M) Config

func (*Config) GetAll

func (c *Config) GetAll() []bson.M

func (*Config) GetPieces

func (bmodel *Config) GetPieces(q bson.M, start int, limit int) []bson.M

GetPieces limit and start in find

func (*Config) GetSortedTop

func (bmodel *Config) GetSortedTop(q bson.M, start int, limit int, sort ...string) []bson.M

GetSortedTop find for sort

func (*Config) InsertMany

func (bmodel *Config) InsertMany(datalist []interface{}) error

InsertMany insert a list to mongo

func (*Config) InsertOne

func (bmodel *Config) InsertOne(data bson.M) bool

InsertOne as name

func (*Config) PublicKey

func (c *Config) PublicKey() string

PublicKey get {"type":"server","dic":{"publickey":"return"}}

func (*Config) Remove

func (bmodel *Config) Remove(query bson.M) error

Remove remove all conform to query, but error will stop TODO it is hardly to supported continue_on_error

func (*Config) UpdateByID

func (bmodel *Config) UpdateByID(id interface{}, data interface{}) error

UpdateByID as name

type EditCfgForm

type EditCfgForm struct {
	Id    string `form:"id"    valid:"Required"`
	Key   string `form:"key" valid:"Required"`
	Input string `form:"input" valid:"Required"`
}

type File

type File struct {
	ID       bson.ObjectId `bson:"_id,omitempty"      json:"_id,omitempty"`
	Platform string        `bson:"platform"       json:"platform"`
	System   string        `bson:"system"   json:"system"`
	Type     string        `bson:"type"   json:"type"`
	Hash     string        `bson:"hash" json:"hash"`
	Uptime   time.Time     `bson:"uptime"   json:"uptime"`
	// contains filtered or unexported fields
}

func NewFile

func NewFile() File

func (*File) Aggregate

func (bmodel *File) Aggregate(querylist ...bson.M) []bson.M

Aggregate db.aggregate

func (*File) Count

func (bmodel *File) Count(query bson.M) int

Count count the file result number

func (*File) CountSubList

func (bmodel *File) CountSubList(query bson.M, listkey string) int

CountSubList count the list item in one collection

func (*File) Distinct

func (bmodel *File) Distinct(query bson.M, key string) []interface{}

Distinct return only one key in find result

func (*File) Find

func (bmodel *File) Find(query bson.M, start int, limit int, sort ...string) []bson.M

Find base find function

func (*File) FindAll

func (bmodel *File) FindAll(query bson.M) []bson.M

FindAll as name

func (*File) FindByID

func (bmodel *File) FindByID(id bson.ObjectId) bson.M

FindByID as name

func (*File) FindOne

func (c *File) FindOne(selector bson.M) File

func (*File) GetAll

func (bmodel *File) GetAll() []bson.M

GetAll get all document in collection

func (*File) GetPieces

func (bmodel *File) GetPieces(q bson.M, start int, limit int) []bson.M

GetPieces limit and start in find

func (*File) GetSortedTop

func (bmodel *File) GetSortedTop(q bson.M, start int, limit int, sort ...string) []bson.M

GetSortedTop find for sort

func (*File) InsertMany

func (bmodel *File) InsertMany(datalist []interface{}) error

InsertMany insert a list to mongo

func (*File) InsertOne

func (bmodel *File) InsertOne(data bson.M) bool

InsertOne as name

func (*File) Remove

func (bmodel *File) Remove(query bson.M) error

Remove remove all conform to query, but error will stop TODO it is hardly to supported continue_on_error

func (*File) Update

func (c *File) Update() bool

func (*File) UpdateByID

func (bmodel *File) UpdateByID(id interface{}, data interface{}) error

UpdateByID as name

type Info

type Info struct {
	Id     bson.ObjectId       `bson:"_id"      json:"_id,omitempty"`
	Ip     string              `bson:"ip"       json:"ip"`
	System string              `bson:"system"   json:"system"`
	Type   string              `bson:"type" json:"type"`
	Data   []map[string]string `bson:"data" json:"data"`
	Uptime time.Time           `bson:"uptime"   json:"uptime,omitempty"`
	// contains filtered or unexported fields
}

User model definiton.

func NewInfo

func NewInfo() Info

func (*Info) Aggregate

func (c *Info) Aggregate(querylist ...bson.M) []bson.M

func (*Info) AllValue

func (c *Info) AllValue(fieldname string, limitnum int) interface{}

func (*Info) Count

func (bmodel *Info) Count(query bson.M) int

Count count the file result number

func (*Info) CountSubList

func (bmodel *Info) CountSubList(query bson.M, listkey string) int

CountSubList count the list item in one collection

func (*Info) Distinct

func (bmodel *Info) Distinct(query bson.M, key string) []interface{}

Distinct return only one key in find result

func (*Info) Find

func (bmodel *Info) Find(query bson.M, start int, limit int, sort ...string) []bson.M

Find base find function

func (*Info) FindAll

func (bmodel *Info) FindAll(query bson.M) []bson.M

FindAll as name

func (*Info) FindByID

func (bmodel *Info) FindByID(id bson.ObjectId) bson.M

FindByID as name

func (*Info) FindOne

func (bmodel *Info) FindOne(query bson.M) bson.M

FindOne get one result

func (*Info) GetAll

func (bmodel *Info) GetAll() []bson.M

GetAll get all document in collection

func (*Info) GetInfoByIp

func (c *Info) GetInfoByIp(ip string) []Info

func (*Info) GetPieces

func (bmodel *Info) GetPieces(q bson.M, start int, limit int) []bson.M

GetPieces limit and start in find

func (*Info) GetSortedTop

func (bmodel *Info) GetSortedTop(q bson.M, start int, limit int, sort ...string) []bson.M

GetSortedTop find for sort

func (*Info) InsertMany

func (bmodel *Info) InsertMany(datalist []interface{}) error

InsertMany insert a list to mongo

func (*Info) InsertOne

func (bmodel *Info) InsertOne(data bson.M) bool

InsertOne as name

func (*Info) Remove

func (bmodel *Info) Remove(query bson.M) error

Remove remove all conform to query, but error will stop TODO it is hardly to supported continue_on_error

func (*Info) UpdateByID

func (bmodel *Info) UpdateByID(id interface{}, data interface{}) error

UpdateByID as name

type Monitor

type Monitor struct {
	ID   bson.ObjectId     `bson:"_id"      json:"_id,omitempty"`
	IP   string            `bson:"ip"       json:"ip"`
	Type string            `bson:"type" json:"type"`
	Data map[string]string `bson:"data" json:"data"`
	Time time.Time         `bson:"time"   json:"time,omitempty"`
	// contains filtered or unexported fields
}

Monitor model definiton.

func NewMonitor

func NewMonitor() Monitor

func (*Monitor) Aggregate

func (bmodel *Monitor) Aggregate(querylist ...bson.M) []bson.M

Aggregate db.aggregate

func (*Monitor) Count

func (bmodel *Monitor) Count(query bson.M) int

Count count the file result number

func (*Monitor) CountSubList

func (bmodel *Monitor) CountSubList(query bson.M, listkey string) int

CountSubList count the list item in one collection

func (*Monitor) Distinct

func (bmodel *Monitor) Distinct(query bson.M, key string) []interface{}

Distinct return only one key in find result

func (*Monitor) Find

func (bmodel *Monitor) Find(query bson.M, start int, limit int, sort ...string) []bson.M

Find base find function

func (*Monitor) FindAll

func (bmodel *Monitor) FindAll(query bson.M) []bson.M

FindAll as name

func (*Monitor) FindByID

func (bmodel *Monitor) FindByID(id bson.ObjectId) bson.M

FindByID as name

func (*Monitor) FindOne

func (bmodel *Monitor) FindOne(query bson.M) bson.M

FindOne get one result

func (*Monitor) GetAll

func (bmodel *Monitor) GetAll() []bson.M

GetAll get all document in collection

func (*Monitor) GetAllType

func (c *Monitor) GetAllType(ip string) []string

func (*Monitor) GetPieces

func (bmodel *Monitor) GetPieces(q bson.M, start int, limit int) []bson.M

GetPieces limit and start in find

func (*Monitor) GetSortedTop

func (bmodel *Monitor) GetSortedTop(q bson.M, start int, limit int, sort ...string) []bson.M

GetSortedTop find for sort

func (*Monitor) InsertMany

func (bmodel *Monitor) InsertMany(datalist []interface{}) error

InsertMany insert a list to mongo

func (*Monitor) InsertOne

func (bmodel *Monitor) InsertOne(data bson.M) bool

InsertOne as name

func (*Monitor) Query

func (c *Monitor) Query(start int, limit int, ip string, typeStr string) []Monitor

func (*Monitor) Remove

func (bmodel *Monitor) Remove(query bson.M) error

Remove remove all conform to query, but error will stop TODO it is hardly to supported continue_on_error

func (*Monitor) UpdateByID

func (bmodel *Monitor) UpdateByID(id interface{}, data interface{}) error

UpdateByID as name

type NewTaskInfo

type NewTaskInfo struct {
	Status int           `json:"status"`
	Msg    string        `json:"msg"`
	TaskId bson.ObjectId `json:"_id"`
}

type Notice

type Notice struct {
	Id     bson.ObjectId `bson:"_id"      json:"_id,omitempty"`
	Info   string        `bson:"info"       json:"info"`
	Status int           `bson:"status"   json:"status"`
	Time   time.Time     `bson:"time" json:"time,omitempty"`
	Type   string        `bson:"type"   json:"type"`
	Ip     string        `bson:"ip"   json:"ip"`
	Source string        `bson:"source"   json:"source"`
	Level  int           `bson:"level"   json:"level"`
	// contains filtered or unexported fields
}

User model definiton.

func NewNotice

func NewNotice() Notice

func (*Notice) Aggregate

func (bmodel *Notice) Aggregate(querylist ...bson.M) []bson.M

Aggregate db.aggregate

func (*Notice) ChangeStatusbyId

func (c *Notice) ChangeStatusbyId(id string, status int) bool

func (*Notice) Count

func (bmodel *Notice) Count(query bson.M) int

Count count the file result number

func (*Notice) CountPerByKey

func (c *Notice) CountPerByKey(match bson.M, key string) []bson.M

func (*Notice) CountPerDay

func (c *Notice) CountPerDay(match bson.M) []bson.M

func (*Notice) CountPerHour

func (c *Notice) CountPerHour(match bson.M) []bson.M

func (*Notice) CountSubList

func (bmodel *Notice) CountSubList(query bson.M, listkey string) int

CountSubList count the list item in one collection

func (*Notice) Distinct

func (bmodel *Notice) Distinct(query bson.M, key string) []interface{}

Distinct return only one key in find result

func (*Notice) Find

func (bmodel *Notice) Find(query bson.M, start int, limit int, sort ...string) []bson.M

Find base find function

func (*Notice) FindAll

func (bmodel *Notice) FindAll(query bson.M) []bson.M

FindAll as name

func (*Notice) FindByID

func (bmodel *Notice) FindByID(id bson.ObjectId) bson.M

FindByID as name

func (*Notice) FindOne

func (bmodel *Notice) FindOne(query bson.M) bson.M

FindOne get one result

func (*Notice) GetAll

func (bmodel *Notice) GetAll() []bson.M

GetAll get all document in collection

func (*Notice) GetPieces

func (bmodel *Notice) GetPieces(q bson.M, start int, limit int) []bson.M

GetPieces limit and start in find

func (*Notice) GetSortedTop

func (bmodel *Notice) GetSortedTop(q bson.M, start int, limit int, sort ...string) []bson.M

GetSortedTop find for sort

func (*Notice) InfoRanking

func (c *Notice) InfoRanking() []bson.M

func (*Notice) InsertMany

func (bmodel *Notice) InsertMany(datalist []interface{}) error

InsertMany insert a list to mongo

func (*Notice) InsertOne

func (bmodel *Notice) InsertOne(data bson.M) bool

InsertOne as name

func (*Notice) LearnEnding

func (c *Notice) LearnEnding() bool

LearnEnding done watch mode ending action

func (*Notice) Remove

func (bmodel *Notice) Remove(query bson.M) error

Remove remove all conform to query, but error will stop TODO it is hardly to supported continue_on_error

func (*Notice) UpdateAll

func (c *Notice) UpdateAll(selector bson.M, update bson.M) error

UpdateAll update many

func (*Notice) UpdateByID

func (bmodel *Notice) UpdateByID(id interface{}, data interface{}) error

UpdateByID as name

type Queue

type Queue struct {
	ID      bson.ObjectId `bson:"_id,omitempty"      json:"_id,omitempty"`
	TaskID  bson.ObjectId `bson:"task_id"      json:"_task_id"`
	Time    time.Time     `bson:"time"   json:"time"`
	IP      string        `bson:"ip"   json:"ip"`
	Type    string        `bson:"type"   json:"type"`
	Command string        `bson:"command"   json:"command"`
	// contains filtered or unexported fields
}

func NewQueue

func NewQueue() Queue

func (*Queue) Aggregate

func (bmodel *Queue) Aggregate(querylist ...bson.M) []bson.M

Aggregate db.aggregate

func (*Queue) Count

func (bmodel *Queue) Count(query bson.M) int

Count count the file result number

func (*Queue) CountSubList

func (bmodel *Queue) CountSubList(query bson.M, listkey string) int

CountSubList count the list item in one collection

func (*Queue) Distinct

func (bmodel *Queue) Distinct(query bson.M, key string) []interface{}

Distinct return only one key in find result

func (*Queue) Find

func (bmodel *Queue) Find(query bson.M, start int, limit int, sort ...string) []bson.M

Find base find function

func (*Queue) FindAll

func (bmodel *Queue) FindAll(query bson.M) []bson.M

FindAll as name

func (*Queue) FindByID

func (bmodel *Queue) FindByID(id bson.ObjectId) bson.M

FindByID as name

func (*Queue) FindOne

func (bmodel *Queue) FindOne(query bson.M) bson.M

FindOne get one result

func (*Queue) GetAll

func (bmodel *Queue) GetAll() []bson.M

GetAll get all document in collection

func (*Queue) GetPieces

func (bmodel *Queue) GetPieces(q bson.M, start int, limit int) []bson.M

GetPieces limit and start in find

func (*Queue) GetSortedTop

func (bmodel *Queue) GetSortedTop(q bson.M, start int, limit int, sort ...string) []bson.M

GetSortedTop find for sort

func (*Queue) InsertMany

func (bmodel *Queue) InsertMany(datalist []interface{}) error

InsertMany insert a list to mongo

func (*Queue) InsertOne

func (bmodel *Queue) InsertOne(data bson.M) bool

InsertOne as name

func (*Queue) Remove

func (bmodel *Queue) Remove(query bson.M) error

Remove remove all conform to query, but error will stop TODO it is hardly to supported continue_on_error

func (*Queue) Save

func (c *Queue) Save() bool

func (*Queue) UpdateByID

func (bmodel *Queue) UpdateByID(id interface{}, data interface{}) error

UpdateByID as name

type Rule

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

func NewRule

func NewRule() Rule

func (*Rule) Aggregate

func (bmodel *Rule) Aggregate(querylist ...bson.M) []bson.M

Aggregate db.aggregate

func (*Rule) Count

func (bmodel *Rule) Count(query bson.M) int

Count count the file result number

func (*Rule) CountSubList

func (bmodel *Rule) CountSubList(query bson.M, listkey string) int

CountSubList count the list item in one collection

func (*Rule) Distinct

func (bmodel *Rule) Distinct(query bson.M, key string) []interface{}

Distinct return only one key in find result

func (*Rule) Find

func (bmodel *Rule) Find(query bson.M, start int, limit int, sort ...string) []bson.M

Find base find function

func (*Rule) FindAll

func (bmodel *Rule) FindAll(query bson.M) []bson.M

FindAll as name

func (*Rule) FindByID

func (bmodel *Rule) FindByID(id bson.ObjectId) bson.M

FindByID as name

func (*Rule) FindOne

func (bmodel *Rule) FindOne(query bson.M) bson.M

FindOne get one result

func (*Rule) GetAll

func (bmodel *Rule) GetAll() []bson.M

GetAll get all document in collection

func (*Rule) GetPieces

func (bmodel *Rule) GetPieces(q bson.M, start int, limit int) []bson.M

GetPieces limit and start in find

func (*Rule) GetSortedTop

func (bmodel *Rule) GetSortedTop(q bson.M, start int, limit int, sort ...string) []bson.M

GetSortedTop find for sort

func (*Rule) InsertMany

func (bmodel *Rule) InsertMany(datalist []interface{}) error

InsertMany insert a list to mongo

func (*Rule) InsertOne

func (bmodel *Rule) InsertOne(data bson.M) bool

InsertOne as name

func (*Rule) Remove

func (bmodel *Rule) Remove(query bson.M) error

Remove remove all conform to query, but error will stop TODO it is hardly to supported continue_on_error

func (*Rule) UpdateByID

func (bmodel *Rule) UpdateByID(id interface{}, data interface{}) error

UpdateByID as name

type SearchForm

type SearchForm struct {
	Keyword string `json:"keyword"`
}

type Server

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

Server model definiton.

func NewServer

func NewServer() Server

NewServer init collectionName

func (*Server) Aggregate

func (bmodel *Server) Aggregate(querylist ...bson.M) []bson.M

Aggregate db.aggregate

func (*Server) Count

func (bmodel *Server) Count(query bson.M) int

Count count the file result number

func (*Server) CountSubList

func (bmodel *Server) CountSubList(query bson.M, listkey string) int

CountSubList count the list item in one collection

func (*Server) Distinct

func (bmodel *Server) Distinct(query bson.M, key string) []interface{}

Distinct return only one key in find result

func (*Server) Find

func (bmodel *Server) Find(query bson.M, start int, limit int, sort ...string) []bson.M

Find base find function

func (*Server) FindAll

func (bmodel *Server) FindAll(query bson.M) []bson.M

FindAll as name

func (*Server) FindByID

func (bmodel *Server) FindByID(id bson.ObjectId) bson.M

FindByID as name

func (*Server) FindOne

func (bmodel *Server) FindOne(query bson.M) bson.M

FindOne get one result

func (*Server) GetAll

func (bmodel *Server) GetAll() []bson.M

GetAll get all document in collection

func (*Server) GetPieces

func (bmodel *Server) GetPieces(q bson.M, start int, limit int) []bson.M

GetPieces limit and start in find

func (*Server) GetSortedTop

func (bmodel *Server) GetSortedTop(q bson.M, start int, limit int, sort ...string) []bson.M

GetSortedTop find for sort

func (*Server) InsertMany

func (bmodel *Server) InsertMany(datalist []interface{}) error

InsertMany insert a list to mongo

func (*Server) InsertOne

func (bmodel *Server) InsertOne(data bson.M) bool

InsertOne as name

func (*Server) Remove

func (bmodel *Server) Remove(query bson.M) error

Remove remove all conform to query, but error will stop TODO it is hardly to supported continue_on_error

func (*Server) UpdateByID

func (bmodel *Server) UpdateByID(id interface{}, data interface{}) error

UpdateByID as name

type Statistics

type Statistics struct {
	ID         bson.ObjectId `bson:"_id"      json:"_id,omitempty"`
	Uptime     time.Time     `bson:"uptime" json:"uptime,omitempty"`
	Type       string        `bson:"type" json:"type"`
	Info       string        `bson:"info" json:"info"`
	Count      int           `bson:"count" json:"count"`
	ServerList []string      `bson:"server_list" json:"server_list"`
	// contains filtered or unexported fields
}

Statistics model definiton.

func NewStatistics

func NewStatistics() Statistics

func (*Statistics) Aggregate

func (bmodel *Statistics) Aggregate(querylist ...bson.M) []bson.M

Aggregate db.aggregate

func (*Statistics) AllValue

func (c *Statistics) AllValue(fieldname string, limitnum int) interface{}

func (*Statistics) Count

func (bmodel *Statistics) Count(query bson.M) int

Count count the file result number

func (*Statistics) CountSubList

func (bmodel *Statistics) CountSubList(query bson.M, listkey string) int

CountSubList count the list item in one collection

func (*Statistics) Distinct

func (bmodel *Statistics) Distinct(query bson.M, key string) []interface{}

Distinct return only one key in find result

func (*Statistics) Find

func (bmodel *Statistics) Find(query bson.M, start int, limit int, sort ...string) []bson.M

Find base find function

func (*Statistics) FindAll

func (bmodel *Statistics) FindAll(query bson.M) []bson.M

FindAll as name

func (*Statistics) FindByID

func (bmodel *Statistics) FindByID(id bson.ObjectId) bson.M

FindByID as name

func (*Statistics) FindOne

func (bmodel *Statistics) FindOne(query bson.M) bson.M

FindOne get one result

func (*Statistics) GetAll

func (bmodel *Statistics) GetAll() []bson.M

GetAll get all document in collection

func (*Statistics) GetPieces

func (bmodel *Statistics) GetPieces(q bson.M, start int, limit int) []bson.M

GetPieces limit and start in find

func (*Statistics) GetSortedTop

func (bmodel *Statistics) GetSortedTop(q bson.M, start int, limit int, sort ...string) []bson.M

GetSortedTop find for sort

func (*Statistics) InsertMany

func (bmodel *Statistics) InsertMany(datalist []interface{}) error

InsertMany insert a list to mongo

func (*Statistics) InsertOne

func (bmodel *Statistics) InsertOne(data bson.M) bool

InsertOne as name

func (*Statistics) Query

func (c *Statistics) Query(match bson.M, start int, limit int) []bson.M

Query db.getCollection('statistics').GetSortedTop

func (*Statistics) Remove

func (bmodel *Statistics) Remove(query bson.M) error

Remove remove all conform to query, but error will stop TODO it is hardly to supported continue_on_error

func (*Statistics) UpdateByID

func (bmodel *Statistics) UpdateByID(id interface{}, data interface{}) error

UpdateByID as name

type StatusForm

type StatusForm struct {
	Id     string `form:"id"    valid:"Required"`
	Info   string `form:"info"    valid:""`
	Type   string `form:"type" valid:""`
	Status int    `form:"status" valid:""`
}

type Task

type Task struct {
	ID       bson.ObjectId `bson:"_id,omitempty"      json:"_id,omitempty"`
	Name     string        `bson:"name"       json:"name"`
	Time     time.Time     `bson:"time"   json:"time"`
	HostList []string      `bson:"host_list"   json:"host_list"`
	Type     string        `bson:"type"   json:"type"`
	Command  string        `bson:"command"   json:"command"`
	// contains filtered or unexported fields
}

func NewTask

func NewTask() Task

func (*Task) Aggregate

func (bmodel *Task) Aggregate(querylist ...bson.M) []bson.M

Aggregate db.aggregate

func (*Task) ChangeStatusbyId

func (c *Task) ChangeStatusbyId(id string, status int) bool

func (*Task) Count

func (bmodel *Task) Count(query bson.M) int

Count count the file result number

func (*Task) CountSubList

func (bmodel *Task) CountSubList(query bson.M, listkey string) int

CountSubList count the list item in one collection

func (*Task) Distinct

func (bmodel *Task) Distinct(query bson.M, key string) []interface{}

Distinct return only one key in find result

func (*Task) Find

func (bmodel *Task) Find(query bson.M, start int, limit int, sort ...string) []bson.M

Find base find function

func (*Task) FindAll

func (bmodel *Task) FindAll(query bson.M) []bson.M

FindAll as name

func (*Task) FindByID

func (bmodel *Task) FindByID(id bson.ObjectId) bson.M

FindByID as name

func (*Task) FindOne

func (bmodel *Task) FindOne(query bson.M) bson.M

FindOne get one result

func (*Task) GetAll

func (bmodel *Task) GetAll() []bson.M

GetAll get all document in collection

func (*Task) GetPieces

func (bmodel *Task) GetPieces(q bson.M, start int, limit int) []bson.M

GetPieces limit and start in find

func (*Task) GetSortedTop

func (bmodel *Task) GetSortedTop(q bson.M, start int, limit int, sort ...string) []bson.M

GetSortedTop find for sort

func (*Task) InsertMany

func (bmodel *Task) InsertMany(datalist []interface{}) error

InsertMany insert a list to mongo

func (*Task) InsertOne

func (bmodel *Task) InsertOne(data bson.M) bool

InsertOne as name

func (*Task) Remove

func (bmodel *Task) Remove(query bson.M) error

Remove remove all conform to query, but error will stop TODO it is hardly to supported continue_on_error

func (*Task) Save

func (c *Task) Save() bool

func (*Task) UpdateByID

func (bmodel *Task) UpdateByID(id interface{}, data interface{}) error

UpdateByID as name

type TaskForm

type TaskForm struct {
	Name      string   `form:"name"        valid:"Required"`
	Tag       string   `form:"tag"         valid:"Required"`
	Type      string   `form:"type"        valid:"Required"`
	Command   string   `form:"command"     valid:"Required"`
	Host_List []string `form:"host_list"   valid:"Required"`
}

type TaskResult

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

func NewTaskResult

func NewTaskResult() TaskResult

func (*TaskResult) Aggregate

func (bmodel *TaskResult) Aggregate(querylist ...bson.M) []bson.M

Aggregate db.aggregate

func (*TaskResult) Count

func (bmodel *TaskResult) Count(query bson.M) int

Count count the file result number

func (*TaskResult) CountSubList

func (bmodel *TaskResult) CountSubList(query bson.M, listkey string) int

CountSubList count the list item in one collection

func (*TaskResult) Distinct

func (bmodel *TaskResult) Distinct(query bson.M, key string) []interface{}

Distinct return only one key in find result

func (*TaskResult) Find

func (bmodel *TaskResult) Find(query bson.M, start int, limit int, sort ...string) []bson.M

Find base find function

func (*TaskResult) FindAll

func (bmodel *TaskResult) FindAll(query bson.M) []bson.M

FindAll as name

func (*TaskResult) FindByID

func (bmodel *TaskResult) FindByID(id bson.ObjectId) bson.M

FindByID as name

func (*TaskResult) FindOne

func (bmodel *TaskResult) FindOne(query bson.M) bson.M

FindOne get one result

func (*TaskResult) GetAll

func (bmodel *TaskResult) GetAll() []bson.M

GetAll get all document in collection

func (*TaskResult) GetPieces

func (bmodel *TaskResult) GetPieces(q bson.M, start int, limit int) []bson.M

GetPieces limit and start in find

func (*TaskResult) GetSortedTop

func (bmodel *TaskResult) GetSortedTop(q bson.M, start int, limit int, sort ...string) []bson.M

GetSortedTop find for sort

func (*TaskResult) InsertMany

func (bmodel *TaskResult) InsertMany(datalist []interface{}) error

InsertMany insert a list to mongo

func (*TaskResult) InsertOne

func (bmodel *TaskResult) InsertOne(data bson.M) bool

InsertOne as name

func (*TaskResult) Remove

func (bmodel *TaskResult) Remove(query bson.M) error

Remove remove all conform to query, but error will stop TODO it is hardly to supported continue_on_error

func (*TaskResult) UpdateByID

func (bmodel *TaskResult) UpdateByID(id interface{}, data interface{}) error

UpdateByID as name

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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