cockroach

package
v0.0.0-...-e168591 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2017 License: MIT, MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ActionCreate = "create"
	ActionUpdate = "update"
	ActionDelete = "delete"
	ActionIndex  = "index"
)

See http://www.elasticsearch.org/guide/en/elasticsearch/guide/current/bulk.html

Variables

This section is empty.

Functions

This section is empty.

Types

type BulkRequest

type BulkRequest struct {
	Action string
	Index  string
	Type   string
	ID     string
	Parent string

	Data map[string]interface{}
}

type BulkResponse

type BulkResponse struct {
	Code   int
	Took   int  `json:"took"`
	Errors bool `json:"errors"`

	Items []map[string]*BulkResponseItem `json:"items"`
}

type BulkResponseItem

type BulkResponseItem struct {
	Index   string          `json:"_index"`
	Type    string          `json:"_type"`
	ID      string          `json:"_id"`
	Version int             `json:"_version"`
	Status  int             `json:"status"`
	Error   json.RawMessage `json:"error"`
	Found   bool            `json:"found"`
}

type Client

type Client struct {
	CockDBName   string
	CockAddr     string
	CockUser     string
	CockPassword string

	Seelog *mainlog.LoggerInterface
	DB     *gorm.DB
}

Although there are many cockroachdb clients with Go, I still want to implement one by myself. Because we only need some very simple usages.

func NewClient

func NewClient(conf *ClientConfig) *Client

func (*Client) Close

func (c *Client) Close()

func (*Client) CockroachBulk

func (c *Client) CockroachBulk(r *BulkRequest) error

func (*Client) DoUpdatePrice

func (c *Client) DoUpdatePrice(body map[string]interface{}) error

func (*Client) DoUpdateStock

func (c *Client) DoUpdateStock(body map[string]interface{}) error

type ClientConfig

type ClientConfig struct {
	CockDBName   string
	CockAddr     string
	CockUser     string
	CockPassword string
	SeelogFile   string
}

type CockPartNumber

type CockPartNumber struct {
	ID                int64
	Part              string  `gorm:"column:pro_sno"`
	Cat               string  `gorm:"column:pro_cat"`
	Imag              string  `gorm:"column:pro_img"`
	Promaf            string  `gorm:"column:pro_maf"`
	BaseSalePrice     float64 `gorm:"column:base_sale_price"`
	Stock             int64   `gorm:"column:stock"`
	SupPart           string  `gorm:"column:suppart"`
	Moq               int64   `gorm:"column:moq"`
	Mbuy              float64 `gorm:"column:mbuy"`
	Currency          string  `gorm:"column:currency"`
	KuCunDi           string  `gorm:"column:kucundi"`
	CunHuoWeiZhi      string  `gorm:"column:kucunweizi"`
	BasePurchasePrice float64 `gorm:"column:base_pur_price"`
	PiHao             string  `gorm:"column:pihao"`
	Package           string  `gorm:"column:pkg"`
	Spq               int64   `gorm:"column:spq"`
	FutureCN          string  `gorm:"column:futurecn"`

	Pname               string  `gorm:"column:pname"`
	PurchaseNum1        int64   `gorm:"column:purnum1"`
	PurchaseNum2        int64   `gorm:"column:purnum2"`
	PurchaseNum3        int64   `gorm:"column:purnum3"`
	PurchaseNum4        int64   `gorm:"column:purnum4"`
	PurchaseNum5        int64   `gorm:"column:purnum5"`
	PurchaseNum6        int64   `gorm:"column:purnum6"`
	PurchaseNum7        int64   `gorm:"column:purnum7"`
	PurchaseNum8        int64   `gorm:"column:purnum8"`
	PurchaseNum9        int64   `gorm:"column:purnum9"`
	PurchaseNum10       int64   `gorm:"column:purnum10"`
	SalesUnitPrice1     float64 `gorm:"column:saluprice1"`
	SalesUnitPrice2     float64 `gorm:"column:saluprice2"`
	SalesUnitPrice3     float64 `gorm:"column:saluprice3"`
	SalesUnitPrice4     float64 `gorm:"column:saluprice4"`
	SalesUnitPrice5     float64 `gorm:"column:saluprice5"`
	SalesUnitPrice6     float64 `gorm:"column:saluprice6"`
	SalesUnitPrice7     float64 `gorm:"column:saluprice7"`
	SalesUnitPrice8     float64 `gorm:"column:saluprice8"`
	SalesUnitPrice9     float64 `gorm:"column:saluprice9"`
	SalesUnitPrice10    float64 `gorm:"column:saluprice10"`
	PurchaseUnitPrice1  float64 `gorm:"column:purunit_price1"`
	PurchaseUnitPrice2  float64 `gorm:"column:purunit_price2"`
	PurchaseUnitPrice3  float64 `gorm:"column:purunit_price3"`
	PurchaseUnitPrice4  float64 `gorm:"column:purunit_price4"`
	PurchaseUnitPrice5  float64 `gorm:"column:purunit_price5"`
	PurchaseUnitPrice6  float64 `gorm:"column:purunit_price6"`
	PurchaseUnitPrice7  float64 `gorm:"column:purunit_price7"`
	PurchaseUnitPrice8  float64 `gorm:"column:purunit_price8"`
	PurchaseUnitPrice9  float64 `gorm:"column:purunit_price9"`
	PurchaseUnitPrice10 float64 `gorm:"column:purunit_price10"`
	Comments            string  `gorm:"column:comments"`
	Description         string  `gorm:"column:pro_desc"`
	SaleChannel         string  `gorm:"column:sale_channel"`
	ProductDetail       string  `gorm:"column:pro_detail"`
	Datasheet           string  `gorm:"column:datasheet"`
	Rosh                string  `gorm:"column:rosh"`
	StockBiaoStock      string  `gorm:"column:stock_biao"`
	NotUse1             string  `gorm:"column:not_use1"`
	NotUse2             string  `gorm:"column:not_use2"`
	PartEN              string  `gorm:"column:parten"`
	PromatEN            string  `gorm:"column:promaten"`
	FutureEN            string  `gorm:"column:futureen"`
	DescriptionEN       string  `gorm:"column:descen"`
	// contains filtered or unexported fields
}

CSVPartNumber csvpart

type Response

type Response struct {
	Code int
	ResponseItem
}

type ResponseItem

type ResponseItem struct {
	ID      string                 `json:"_id"`
	Index   string                 `json:"_index"`
	Type    string                 `json:"_type"`
	Version int                    `json:"_version"`
	Found   bool                   `json:"found"`
	Source  map[string]interface{} `json:"_source"`
}

type TProSellPrice

type TProSellPrice struct {
	// gorm.Model
	MysqlID    int64     `gorm:"column:mysql_id"`
	ProSellID  int64     `gorm:"column:pro_sell_id"`
	Sku        int64     `gorm:"column:sku"`
	PriceType  int64     `gorm:"column:price_type"`
	CurrencyID int64     `gorm:"column:currency_id"`
	Price1     float64   `gorm:"type:decimal(15,6);"`
	Number1    int64     `gorm:"column:number1"`
	Price2     float64   `gorm:"type:decimal(15,6);"`
	Number2    int64     `gorm:"column:number2"`
	Price3     float64   `gorm:"type:decimal(15,6);"`
	Number3    int64     `gorm:"column:number3"`
	Price4     float64   `gorm:"type:decimal(15,6);"`
	Number4    int64     `gorm:"column:number4"`
	Price5     float64   `gorm:"type:decimal(15,6);"`
	Number5    int64     `gorm:"column:number5"`
	Price6     float64   `gorm:"type:decimal(15,6);"`
	Number6    int64     `gorm:"column:number6"`
	Price7     float64   `gorm:"type:decimal(15,6);"`
	Number7    int64     `gorm:"column:number7"`
	Price8     float64   `gorm:"type:decimal(15,6);"`
	Number8    int64     `gorm:"column:number8"`
	Price9     float64   `gorm:"type:decimal(15,6);"`
	Number9    int64     `gorm:"column:number9"`
	Price10    float64   `gorm:"type:decimal(15,6);"`
	Number10   int64     `gorm:"column:number10"`
	Status     int64     `gorm:"column:status"`
	LastUpTime int64     `gorm:"column:last_update_time"`
	OpAdminID  int64     `gorm:"column:op_admin_id"`
	LUptime    time.Time `gorm:"column:luptime"`
}

type TProSellStock

type TProSellStock struct {
	// gorm.Model
	Sku        int64
	Stocknum   int64     `gorm:"column:stock_num"`
	Frozennum  int64     `gorm:"column:frozen_num"`
	Virtualnum int64     `gorm:"column:virtual_num"`
	LastUpTime int64     `gorm:"column:last_update_time"`
	LUptime    time.Time `gorm:"column:luptime"`
}

Jump to

Keyboard shortcuts

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