crawlabgo

package module
v0.0.0-...-0521b6c Latest Latest
Warning

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

Go to latest
Published: May 17, 2020 License: MIT Imports: 7 Imported by: 0

README

crawlab-go-sdk

crawlab-go-sdk

示例

package main

import crawlabgo "github.com/zhangweiii/crawlab-go-sdk"

// Item 示例结构体
// bson 是mongo中列别名,主要排重时候用
type Item struct {
	TaskID string `bson:"task_id"` // 必须要有用于爬虫平台识别结果
	Name   string `bson:"name"`
	Age    int    `bson:"age"`
}

func main() {
	for i := 0; i < 1000; i++ {
		crawlabgo.SaveItem(&Item{
			Name: "crawlabgo",
			Age:  i,
		})
	}
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Close

func Close()

Close 关闭连接

func SaveItem

func SaveItem(item interface{}) error

SaveItem 保存文档到数据库

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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