本文整理匯總了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
}
示例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
}
示例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
}
示例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
}
示例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
}
示例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
}
示例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
}
示例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
}