本文整理汇总了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;未经允许,请勿转载。 |
请发表评论