當前位置: 首頁>>代碼示例>>Golang>>正文


Golang gorethink.JSON函數代碼示例

本文整理匯總了Golang中github.com/dancannon/gorethink.JSON函數的典型用法代碼示例。如果您正苦於以下問題:Golang JSON函數的具體用法?Golang JSON怎麽用?Golang JSON使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了JSON函數的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: insertMessage

func (a *rethinkAPIServer) insertMessage(table Table, message proto.Message) error {
	data, err := marshaller.MarshalToString(message)
	if err != nil {
		return err
	}
	_, err = a.getTerm(table).Insert(gorethink.JSON(data)).RunWrite(a.session)
	return err
}
開發者ID:klucar,項目名稱:pachyderm,代碼行數:8,代碼來源:rethink_api_server.go

示例2: CreatePipelineRun

func (c *rethinkClient) CreatePipelineRun(pipelineRun *pps.PipelineRun) error {
	data, err := marshaller.MarshalToString(pipelineRun)
	if err != nil {
		return err
	}
	_, err = c.pipelineRuns.Insert(gorethink.JSON(data)).RunWrite(c.session)
	return err
}
開發者ID:sr,項目名稱:pachyderm,代碼行數:8,代碼來源:rethink_client.go

示例3: addMessage

func (c *rethinkClient) addMessage(term gorethink.Term, message proto.Message) error {
	data, err := marshaller.MarshalToString(message)
	if err != nil {
		return err
	}
	_, err = term.Insert(gorethink.JSON(data)).RunWrite(c.session)
	return err
}
開發者ID:sr,項目名稱:pachyderm,代碼行數:8,代碼來源:rethink_client.go

示例4: CreatePfsCommitMapping

func (c *rethinkClient) CreatePfsCommitMapping(pfsCommitMapping *pps.PfsCommitMapping) error {
	data, err := marshaller.MarshalToString(pfsCommitMapping)
	if err != nil {
		return err
	}
	if _, err := c.pfsCommitMappings.Insert(gorethink.JSON(data)).RunWrite(c.session); err != nil {
		return err
	}
	return nil
}
開發者ID:sr,項目名稱:pachyderm,代碼行數:10,代碼來源:rethink_client.go

示例5: CreatePipelineRunStatus

func (c *rethinkClient) CreatePipelineRunStatus(id string, statusType pps.PipelineRunStatusType) error {
	runStatus := &pps.PipelineRunStatus{
		PipelineRunId:         id,
		PipelineRunStatusType: statusType,
		Timestamp:             prototime.TimeToTimestamp(c.timer.Now()),
	}
	data, err := marshaller.MarshalToString(runStatus)
	if err != nil {
		return err
	}
	_, err = c.pipelineRunStatuses.Insert(gorethink.JSON(data)).RunWrite(c.session)
	return err
}
開發者ID:sr,項目名稱:pachyderm,代碼行數:13,代碼來源:rethink_client.go

示例6: CreatePipelineRunLogs

func (c *rethinkClient) CreatePipelineRunLogs(pipelineLogs ...*pps.PipelineRunLog) error {
	var pipelineLogTerms []gorethink.Term
	for _, pipelineLog := range pipelineLogs {
		data, err := marshaller.MarshalToString(pipelineLog)
		if err != nil {
			return err
		}
		pipelineLogTerms = append(pipelineLogTerms, gorethink.JSON(data))
	}
	if _, err := c.pipelineLogs.Insert(pipelineLogTerms).RunWrite(c.session); err != nil {
		return err
	}
	return nil
}
開發者ID:sr,項目名稱:pachyderm,代碼行數:14,代碼來源:rethink_client.go

示例7: HandleMessage

func (a *ArchiveWorker) HandleMessage(m *nsq.Message) error {
	resp, err := gorethink.Table(a.table).Insert(archivePayload{
		Timestamp: gorethink.Now(),
		Payload:   gorethink.JSON(string(m.Body)),
	}).RunWrite(a.session)
	if err != nil {
		return err
	}
	// if a producer is set then we are to push the resulting data for each of the webhhooks
	// onto a new queue.
	if a.producer != nil {
		return a.pushPayload(resp.GeneratedKeys[0])
	}
	return nil
}
開發者ID:pombredanne,項目名稱:hooks,代碼行數:15,代碼來源:archiver.go

示例8: AddPipelineRunContainers

func (c *rethinkClient) AddPipelineRunContainers(containers ...*pps.PipelineRunContainer) error {
	var pipelineContainers []gorethink.Term
	for _, pipelineContainer := range containers {
		data, err := marshaller.MarshalToString(pipelineContainer)
		if err != nil {
			return err
		}
		pipelineContainers = append(pipelineContainers, gorethink.JSON(data))
	}
	if _, err := c.containers.
		Insert(pipelineContainers).
		RunWrite(c.session); err != nil {
		return err
	}
	return nil
}
開發者ID:kunthar,項目名稱:pachyderm,代碼行數:16,代碼來源:rethink_client.go


注:本文中的github.com/dancannon/gorethink.JSON函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。