mock

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2020 License: BSD-3-Clause Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var NodeIdss = []bson.ObjectId{bson.ObjectIdHex("5d429e6c19f7abede924fee2"),
	bson.ObjectIdHex("5d429e6c19f7abede924fee1")}
View Source
var NodeList = []model.Node{
	{
		Id:           bson.ObjectId("5d429e6c19f7abede924fee2"),
		Ip:           "10.32.35.15",
		Name:         "test1",
		Status:       "online",
		Port:         "8081",
		Mac:          "ac:12:df:12:fd",
		Description:  "For test1",
		IsMaster:     true,
		UpdateTs:     time.Now(),
		CreateTs:     time.Now(),
		UpdateTsUnix: time.Now().Unix(),
	},
	{
		Id:           bson.ObjectId("5d429e6c19f7abede924fe22"),
		Ip:           "10.32.35.12",
		Name:         "test2",
		Status:       "online",
		Port:         "8082",
		Mac:          "ac:12:df:12:vh",
		Description:  "For test2",
		IsMaster:     true,
		UpdateTs:     time.Now(),
		CreateTs:     time.Now(),
		UpdateTsUnix: time.Now().Unix(),
	},
}
View Source
var SpiderList = []model.Spider{
	{
		Id:          bson.ObjectId("5d429e6c19f7abede924fee2"),
		Name:        "For test",
		DisplayName: "test",
		Type:        "test",
		Col:         "test",
		Site:        "www.baidu.com",
		Envs:        nil,
		Src:         "../app/spiders",
		Cmd:         "scrapy crawl test",
		LastRunTs:   time.Now(),
		CreateTs:    time.Now(),
		UpdateTs:    time.Now(),
		UserId:      constants.ObjectIdNull,
	},
}
View Source
var TaskList = []model.Task{
	{
		Id:              "1234",
		SpiderId:        bson.ObjectId("5d429e6c19f7abede924fee2"),
		StartTs:         time.Now(),
		FinishTs:        time.Now(),
		Status:          "进行中",
		NodeId:          bson.ObjectId("5d429e6c19f7abede924fee2"),
		LogPath:         "./log",
		Cmd:             "scrapy crawl test",
		Error:           "",
		ResultCount:     0,
		WaitDuration:    10.0,
		RuntimeDuration: 10,
		TotalDuration:   20,
		SpiderName:      "test",
		NodeName:        "test",
		CreateTs:        time.Now(),
		UpdateTs:        time.Now(),
	},
	{
		Id:              "5678",
		SpiderId:        bson.ObjectId("5d429e6c19f7abede924fee2"),
		StartTs:         time.Now(),
		FinishTs:        time.Now(),
		Status:          "进行中",
		NodeId:          bson.ObjectId("5d429e6c19f7abede924fee2"),
		LogPath:         "./log",
		Cmd:             "scrapy crawl test2",
		Error:           "",
		ResultCount:     0,
		WaitDuration:    10.0,
		RuntimeDuration: 10,
		TotalDuration:   20,
		SpiderName:      "test",
		NodeName:        "test",
		CreateTs:        time.Now(),
		UpdateTs:        time.Now(),
	},
}

Functions

func DeleteNode

func DeleteNode(c *gin.Context)

func DeleteSchedule

func DeleteSchedule(c *gin.Context)

func DeleteSpider

func DeleteSpider(c *gin.Context)

func DeleteTask

func DeleteTask(c *gin.Context)

func DownloadTaskResultsCsv

func DownloadTaskResultsCsv(c *gin.Context)

func GetHomeStats

func GetHomeStats(c *gin.Context)

func GetNode

func GetNode(c *gin.Context)

func GetNodeList

func GetNodeList(c *gin.Context)

func GetNodeTaskList

func GetNodeTaskList(c *gin.Context)

func GetSchedule

func GetSchedule(c *gin.Context)

func GetScheduleList

func GetScheduleList(c *gin.Context)

func GetSpider

func GetSpider(c *gin.Context)

func GetSpiderDir

func GetSpiderDir(c *gin.Context)

func GetSpiderList

func GetSpiderList(c *gin.Context)

func GetSpiderTasks

func GetSpiderTasks(c *gin.Context)

func GetSystemInfo

func GetSystemInfo(c *gin.Context)

func GetTask

func GetTask(c *gin.Context)

func GetTaskList

func GetTaskList(c *gin.Context)

func GetTaskResults

func GetTaskResults(c *gin.Context)

func HandleError

func HandleError(statusCode int, c *gin.Context, err error)

func HandleErrorF

func HandleErrorF(statusCode int, c *gin.Context, err string)

func Ping

func Ping(c *gin.Context)

func PostNode

func PostNode(c *gin.Context)

func PostSchedule

func PostSchedule(c *gin.Context)

func PostSpider

func PostSpider(c *gin.Context)

func PutSchedule

func PutSchedule(c *gin.Context)

func PutTask

func PutTask(c *gin.Context)

Types

type File

type File struct {
	Name  string `json:"name"`
	Path  string `json:"path"`
	IsDir bool   `json:"is_dir"`
	Size  int64  `json:"size"`
}

type ListResponse

type ListResponse struct {
	Status  string      `json:"status"`
	Message string      `json:"message"`
	Total   int         `json:"total"`
	Data    interface{} `json:"data"`
	Error   string      `json:"error"`
}

type Response

type Response struct {
	Status  string      `json:"status"`
	Message string      `json:"message"`
	Data    interface{} `json:"data"`
	Error   string      `json:"error"`
}

type TaskListRequestData

type TaskListRequestData struct {
	PageNum  int    `form:"page_num"`
	PageSize int    `form:"page_size"`
	NodeId   string `form:"node_id"`
	SpiderId string `form:"spider_id"`
}

type TaskResultsRequestData

type TaskResultsRequestData struct {
	PageNum  int `form:"page_num"`
	PageSize int `form:"page_size"`
}

Jump to

Keyboard shortcuts

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