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


Golang system.UnpackUnknownType函數代碼示例

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


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

示例1: UnpackPageInterface

func UnpackPageInterface(ctx context.Context, in system.Packed) (PageInterface, error) {
	switch in.Type() {
	case system.J_MAP:
		i, err := system.UnpackUnknownType(ctx, in, true, "kego.io/demo/demo2", "page")
		if err != nil {
			return nil, err
		}
		ob, ok := i.(PageInterface)
		if !ok {
			return nil, fmt.Errorf("%T does not implement PageInterface", i)
		}
		return ob, nil
	default:
		return nil, fmt.Errorf("Unsupported json type %s when unpacking into PageInterface.", in.Type())
	}
}
開發者ID:kego,項目名稱:ke,代碼行數:16,代碼來源:generated.go

示例2: UnpackSection

func UnpackSection(ctx context.Context, in system.Packed) (Section, error) {
	switch in.Type() {
	case system.J_MAP:
		i, err := system.UnpackUnknownType(ctx, in, true, "kego.io/demo/site", "section")
		if err != nil {
			return nil, err
		}
		ob, ok := i.(Section)
		if !ok {
			return nil, fmt.Errorf("%T does not implement Section", i)
		}
		return ob, nil
	default:
		return nil, fmt.Errorf("Unsupported json type %s when unpacking into Section.", in.Type())
	}
}
開發者ID:kego,項目名稱:ke,代碼行數:16,代碼來源:generated.go

示例3: UnpackFInterface

func UnpackFInterface(ctx context.Context, in system.Packed) (FInterface, error) {
	switch in.Type() {
	case system.J_MAP:
		i, err := system.UnpackUnknownType(ctx, in, true, "kego.io/process/validate/tests", "f")
		if err != nil {
			return nil, err
		}
		ob, ok := i.(FInterface)
		if !ok {
			return nil, fmt.Errorf("%T does not implement FInterface", i)
		}
		return ob, nil
	default:
		return nil, fmt.Errorf("Unsupported json type %s when unpacking into FInterface.", in.Type())
	}
}
開發者ID:kego,項目名稱:ke,代碼行數:16,代碼來源:generated.go

示例4: UnpackLocalized

func UnpackLocalized(ctx context.Context, in system.Packed) (Localized, error) {
	switch in.Type() {
	case system.J_MAP:
		i, err := system.UnpackUnknownType(ctx, in, true, "kego.io/demo/demo5/translation", "localized")
		if err != nil {
			return nil, err
		}
		ob, ok := i.(Localized)
		if !ok {
			return nil, fmt.Errorf("%T does not implement Localized", i)
		}
		return ob, nil
	default:
		return nil, fmt.Errorf("Unsupported json type %s when unpacking into Localized.", in.Type())
	}
}
開發者ID:kego,項目名稱:ke,代碼行數:16,代碼來源:generated.go


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