本文整理汇总了Golang中github.com/stellar/horizon/render/hal.Render函数的典型用法代码示例。如果您正苦于以下问题:Golang Render函数的具体用法?Golang Render怎么用?Golang Render使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Render函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: JSON
// JSON is a method for actions.JSON
func (action *OperationIndexAction) JSON() {
action.LoadPage()
if action.Err != nil {
return
}
hal.Render(action.W, action.Page)
}
开发者ID:raymens,项目名称:horizon,代码行数:8,代码来源:actions_operation.go
示例2: JSON
// JSON is a method for actions.JSON
func (action *OffersByAccountAction) JSON() {
action.LoadPage()
if action.Err != nil {
return
}
hal.Render(action.W, action.Page)
}
开发者ID:raymens,项目名称:horizon,代码行数:8,代码来源:actions_offer.go
示例3: JSON
// JSON is a method for actions.JSON
func (action *OrderBookShowAction) JSON() {
action.Do(action.LoadQuery, action.LoadRecord, action.LoadResource)
action.Do(func() {
hal.Render(action.W, action.Resource)
})
}
开发者ID:irisli,项目名称:horizon,代码行数:8,代码来源:actions_order_book.go
示例4: JSON
// JSON is a method for actions.JSON
func (action *EffectIndexAction) JSON() {
action.Do(action.LoadQuery, action.LoadRecords, action.LoadPage)
action.Do(func() {
hal.Render(action.W, action.Page)
})
}
开发者ID:masonforest,项目名称:horizon,代码行数:8,代码来源:actions_effects.go
示例5: JSON
// JSON is a method for actions.JSON
func (action *AccountShowAction) JSON() {
action.LoadRecord()
if action.Err != nil {
return
}
hal.Render(action.W, NewAccountResource(action.Record))
}
开发者ID:raymens,项目名称:horizon,代码行数:9,代码来源:actions_account.go
示例6: JSON
// JSON is a method for actions.JSON
func (action *TransactionShowAction) JSON() {
action.Do(
action.LoadQuery,
action.LoadRecord,
action.LoadResource,
func() { hal.Render(action.W, action.Resource) },
)
}
开发者ID:masonforest,项目名称:horizon,代码行数:9,代码来源:actions_transaction.go
示例7: JSON
// JSON is a method for actions.JSON
func (action *TransactionShowAction) JSON() {
action.Do(
action.loadParams,
action.loadRecord,
action.loadResource,
func() { hal.Render(action.W, action.Resource) },
)
}
开发者ID:irisli,项目名称:horizon,代码行数:9,代码来源:actions_transaction.go
示例8: JSON
// JSON is a method for actions.JSON
func (action *LedgerIndexAction) JSON() {
action.Do(
action.LoadQuery,
action.LoadRecords,
action.LoadPage,
func() { hal.Render(action.W, action.Page) },
)
}
开发者ID:zenododobird,项目名称:horizon,代码行数:9,代码来源:actions_ledger.go
示例9: JSON
// JSON is a method for actions.JSON
func (action *AccountIndexAction) JSON() {
action.Do(
action.loadParams,
action.loadRecords,
action.loadPage,
func() { hal.Render(action.W, action.Page) },
)
}
开发者ID:irisli,项目名称:horizon,代码行数:9,代码来源:actions_account.go
示例10: JSON
// JSON is a method for actions.JSON
func (action *MetricsAction) JSON() {
db.UpdateLedgerState(action.Ctx, action.App.HistoryQuery(), action.App.CoreQuery())
action.LoadSnapshot()
action.Snapshot["_links"] = map[string]interface{}{
"self": halgo.Link{Href: "/metrics"},
}
hal.Render(action.W, action.Snapshot)
}
开发者ID:lackac,项目名称:horizon,代码行数:10,代码来源:actions_metrics.go
示例11: JSON
// JSON is a method for actions.JSON
func (action *MetricsAction) JSON() {
action.App.UpdateMetrics(action.Ctx)
action.LoadSnapshot()
action.Snapshot["_links"] = map[string]interface{}{
"self": halgo.Link{Href: "/metrics"},
}
hal.Render(action.W, action.Snapshot)
}
开发者ID:raymens,项目名称:horizon,代码行数:10,代码来源:actions_metrics.go
示例12: JSON
// JSON is a method for actions.JSON
func (action *OffersByAccountAction) JSON() {
action.Do(
action.LoadQuery,
action.LoadRecords,
action.LoadPage,
func() {
hal.Render(action.W, action.Page)
},
)
}
开发者ID:zenododobird,项目名称:horizon,代码行数:11,代码来源:actions_offer.go
示例13: JSON
// JSON implements actions.JSON
func (action *PathIndexAction) JSON() {
action.Do(
action.loadQuery,
action.loadSourceAssets,
action.loadRecords,
action.loadPage,
func() {
hal.Render(action.W, action.Page)
},
)
}
开发者ID:irisli,项目名称:horizon,代码行数:12,代码来源:actions_path.go
示例14: JSON
// JSON renders the json response for RootAction
func (action *RootAction) JSON() {
var res resource.Root
res.Populate(
action.Ctx,
action.App.latestLedgerState,
action.App.horizonVersion,
action.App.coreVersion,
)
hal.Render(action.W, res)
}
开发者ID:masonforest,项目名称:horizon,代码行数:12,代码来源:actions_root.go
示例15: JSON
// JSON is a method for actions.JSON
func (action *FriendbotAction) JSON() {
action.Do(
action.CheckEnabled,
action.LoadAddress,
action.LoadResult,
action.LoadResource,
func() {
hal.Render(action.W, action.Resource)
})
}
开发者ID:zenododobird,项目名称:horizon,代码行数:13,代码来源:actions_friendbot.go
示例16: JSON
// JSON is a method for actions.JSON
func (action *DataShowAction) JSON() {
action.Do(
action.loadParams,
action.loadRecord,
func() {
hal.Render(action.W, map[string]string{
"value": action.Data.Value,
})
},
)
}
开发者ID:irisli,项目名称:horizon,代码行数:13,代码来源:actions_data.go
示例17: JSON
// JSON renders the json response for RootAction
func (action *RootAction) JSON() {
action.App.UpdateStellarCoreInfo()
var res resource.Root
res.Populate(
action.Ctx,
action.App.latestLedgerState.Horizon,
action.App.latestLedgerState.Core,
action.App.horizonVersion,
action.App.coreVersion,
action.App.networkPassphrase,
)
hal.Render(action.W, res)
}
开发者ID:irisli,项目名称:horizon,代码行数:16,代码来源:actions_root.go
示例18: JSON
// JSON is a method for actions.JSON
func (action *LedgerShowAction) JSON() {
query := action.Query()
if action.Err != nil {
return
}
action.Err = db.Get(action.Ctx, query, &action.Record)
if action.Err != nil {
return
}
hal.Render(action.W, NewLedgerResource(action.Record))
}
开发者ID:raymens,项目名称:horizon,代码行数:16,代码来源:actions_ledger.go
示例19: JSON
func (action *RootAction) JSON() {
var response = RootResource{
HorizonVersion: action.App.horizonVersion,
StellarCoreVersion: action.App.coreVersion,
Links: halgo.Links{}.
Self("/").
Link("account", "/accounts/{address}").
Link("account_transactions", "/accounts/{address}/transactions{?cursor,limit,order}").
Link("transaction", "/transactions/{hash}").
Link("transactions", "/transactions{?cursor,limit,order}").
Link("order_book", "/order_book{?selling_asset_type,selling_asset_code,selling_issuer,buying_asset_type,buying_asset_code,buying_issuer}").
Link("metrics", "/metrics").
Link("friendbot", "/friendbot{?addr}"),
}
hal.Render(action.W, response)
}
开发者ID:lackac,项目名称:horizon,代码行数:16,代码来源:actions_root.go
示例20: JSON
// JSON format action handler
func (action *TransactionCreateAction) JSON() {
l := action.App.submitter.Submit(action.Ctx, action.GetString("tx"))
select {
case result := <-l:
resource := &ResultResource{result}
if resource.IsSuccess() {
hal.Render(action.W, resource.Success())
} else {
problem.Render(action.Ctx, action.W, resource.Error())
}
case <-action.Ctx.Done():
return
}
}
开发者ID:raymens,项目名称:horizon,代码行数:19,代码来源:actions_transaction.go
注:本文中的github.com/stellar/horizon/render/hal.Render函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论