• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Golang types.RegisterPackage函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Golang中github.com/attic-labs/noms/types.RegisterPackage函数的典型用法代码示例。如果您正苦于以下问题:Golang RegisterPackage函数的具体用法?Golang RegisterPackage怎么用?Golang RegisterPackage使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了RegisterPackage函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。

示例1: TestGenerateDeps

func TestGenerateDeps(t *testing.T) {
	assert := assert.New(t)
	ds := datas.NewDataStore(chunks.NewMemoryStore())
	dir, err := ioutil.TempDir("", "codegen_test_")
	assert.NoError(err)
	defer os.RemoveAll(dir)

	leaf1 := types.NewPackage([]types.Type{types.MakeEnumType("e1", "a", "b")}, []ref.Ref{})
	leaf1Ref := ds.WriteValue(leaf1).TargetRef()
	leaf2 := types.NewPackage([]types.Type{types.MakePrimitiveType(types.BoolKind)}, []ref.Ref{})
	leaf2Ref := ds.WriteValue(leaf2).TargetRef()

	depender := types.NewPackage([]types.Type{}, []ref.Ref{leaf1Ref})
	dependerRef := ds.WriteValue(depender).TargetRef()

	top := types.NewPackage([]types.Type{}, []ref.Ref{leaf2Ref, dependerRef})
	types.RegisterPackage(&top)

	localPkgs := refSet{top.Ref(): true}
	generateDepCode(filepath.Base(dir), dir, map[string]bool{}, top, localPkgs, ds)

	leaf1Path := filepath.Join(dir, code.ToTag(leaf1.Ref())+".go")
	leaf2Path := filepath.Join(dir, code.ToTag(leaf2.Ref())+".go")
	leaf3Path := filepath.Join(dir, code.ToTag(depender.Ref())+".go")
	_, err = os.Stat(leaf1Path)
	assert.NoError(err)
	_, err = os.Stat(leaf2Path)
	assert.NoError(err)
	_, err = os.Stat(leaf3Path)
	assert.NoError(err)
}
开发者ID:arv,项目名称:noms-old,代码行数:31,代码来源:codegen_test.go


示例2: init

// This function builds up a Noms value that describes the type
// package implemented by this file and registers it with the global
// type package definition cache.
func init() {
	p := types.NewPackage([]types.Type{
		types.MakeEnumType("QuarterEnum", "Q1", "Q2", "Q3", "Q4"),
		types.MakeStructType("Quarter",
			[]types.Field{
				types.Field{"Year", types.MakePrimitiveType(types.Int32Kind), false},
				types.Field{"Quarter", types.MakeType(ref.Ref{}, 0), false},
			},
			types.Choices{},
		),
		types.MakeStructType("Key",
			[]types.Field{},
			types.Choices{
				types.Field{"Category", types.MakePrimitiveType(types.StringKind), false},
				types.Field{"Quarter", types.MakeType(ref.Ref{}, 1), false},
				types.Field{"Region", types.MakePrimitiveType(types.StringKind), false},
				types.Field{"RoundType", types.MakeType(ref.Ref{}, 3), false},
				types.Field{"Year", types.MakePrimitiveType(types.Int32Kind), false},
			},
		),
		types.MakeEnumType("RoundTypeEnum", "Seed", "SeriesA", "SeriesB", "SeriesC", "SeriesD", "SeriesE", "SeriesF", "SeriesG", "SeriesH", "UnknownRoundType"),
	}, []ref.Ref{
		ref.Parse("sha1-6c64b08a509e25f9814dbf036489267c957a6fd8"),
		ref.Parse("sha1-91ae65b19b4817fc15d4e2c5c7472c68b4950b77"),
	})
	__mainPackageInFile_index_CachedRef = types.RegisterPackage(&p)
}
开发者ID:arv,项目名称:noms-old,代码行数:30,代码来源:index.noms.go


示例3: init

// This function builds up a Noms value that describes the type
// package implemented by this file and registers it with the global
// type package definition cache.
func init() {
	p := types.NewPackage([]types.Type{
		types.MakeStructType("StructWithUnions",
			[]types.Field{
				types.Field{"a", types.MakeType(ref.Ref{}, 1), false},
				types.Field{"d", types.MakeType(ref.Ref{}, 2), false},
			},
			types.Choices{},
		),
		types.MakeStructType("",
			[]types.Field{},
			types.Choices{
				types.Field{"b", types.MakePrimitiveType(types.Float64Kind), false},
				types.Field{"c", types.MakePrimitiveType(types.StringKind), false},
			},
		),
		types.MakeStructType("",
			[]types.Field{},
			types.Choices{
				types.Field{"e", types.MakePrimitiveType(types.Float64Kind), false},
				types.Field{"f", types.MakePrimitiveType(types.StringKind), false},
			},
		),
	}, []ref.Ref{})
	__genPackageInFile_struct_with_unions_CachedRef = types.RegisterPackage(&p)
}
开发者ID:arv,项目名称:noms-old,代码行数:29,代码来源:struct_with_unions.noms.go


示例4: init

// This function builds up a Noms value that describes the type
// package implemented by this file and registers it with the global
// type package definition cache.
func init() {
	p := types.NewPackage([]types.Type{
		types.MakeStructType("A",
			[]types.Field{
				types.Field{"A", types.MakeCompoundType(types.ListKind, types.MakeCompoundType(types.ListKind, types.MakePrimitiveType(types.BlobKind))), false},
			},
			types.Choices{},
		),
	}, []ref.Ref{})
	__genPackageInFile_sha1_b3ecb0f_CachedRef = types.RegisterPackage(&p)
}
开发者ID:arv,项目名称:noms-old,代码行数:14,代码来源:sha1_b3ecb0f.go


示例5: init

// This function builds up a Noms value that describes the type
// package implemented by this file and registers it with the global
// type package definition cache.
func init() {
	p := types.NewPackage([]types.Type{
		types.MakeStructType("Date",
			[]types.Field{
				types.Field{"MsSinceEpoch", types.MakePrimitiveType(types.Int64Kind), false},
			},
			types.Choices{},
		),
	}, []ref.Ref{})
	__commonPackageInFile_date_CachedRef = types.RegisterPackage(&p)
}
开发者ID:arv,项目名称:noms-old,代码行数:14,代码来源:date.noms.go


示例6: init

// This function builds up a Noms value that describes the type
// package implemented by this file and registers it with the global
// type package definition cache.
func init() {
	p := types.NewPackage([]types.Type{
		types.MakeStructType("StructWithRef",
			[]types.Field{
				types.Field{"r", types.MakeCompoundType(types.RefKind, types.MakeCompoundType(types.SetKind, types.MakePrimitiveType(types.Float32Kind))), false},
			},
			types.Choices{},
		),
	}, []ref.Ref{})
	__genPackageInFile_ref_CachedRef = types.RegisterPackage(&p)
}
开发者ID:arv,项目名称:noms-old,代码行数:14,代码来源:ref.noms.go


示例7: init

// This function builds up a Noms value that describes the type
// package implemented by this file and registers it with the global
// type package definition cache.
func init() {
	p := types.NewPackage([]types.Type{
		types.MakeStructType("StructWithDupList",
			[]types.Field{
				types.Field{"l", types.MakeCompoundType(types.ListKind, types.MakePrimitiveType(types.Uint8Kind)), false},
			},
			types.Choices{},
		),
	}, []ref.Ref{})
	__genPackageInFile_struct_with_dup_list_CachedRef = types.RegisterPackage(&p)
}
开发者ID:arv,项目名称:noms-old,代码行数:14,代码来源:struct_with_dup_list.noms.go


示例8: init

// This function builds up a Noms value that describes the type
// package implemented by this file and registers it with the global
// type package definition cache.
func init() {
	p := types.NewPackage([]types.Type{
		types.MakeStructType("Tree",
			[]types.Field{
				types.Field{"children", types.MakeCompoundType(types.ListKind, types.MakeType(ref.Ref{}, 0)), false},
			},
			types.Choices{},
		),
	}, []ref.Ref{})
	__genPackageInFile_struct_recursive_CachedRef = types.RegisterPackage(&p)
}
开发者ID:arv,项目名称:noms-old,代码行数:14,代码来源:struct_recursive.noms.go


示例9: init

// This function builds up a Noms value that describes the type
// package implemented by this file and registers it with the global
// type package definition cache.
func init() {
	p := types.NewPackage([]types.Type{
		types.MakeEnumType("Handedness", "right", "left", "switch"),
		types.MakeStructType("EnumStruct",
			[]types.Field{
				types.Field{"hand", types.MakeType(ref.Ref{}, 0), false},
			},
			types.Choices{},
		),
	}, []ref.Ref{})
	__genPackageInFile_enum_struct_CachedRef = types.RegisterPackage(&p)
}
开发者ID:arv,项目名称:noms-old,代码行数:15,代码来源:enum_struct.noms.go


示例10: init

// This function builds up a Noms value that describes the type
// package implemented by this file and registers it with the global
// type package definition cache.
func init() {
	p := types.NewPackage([]types.Type{
		types.MakeStructType("Commit",
			[]types.Field{
				types.Field{"value", types.MakePrimitiveType(types.ValueKind), false},
				types.Field{"parents", types.MakeCompoundType(types.SetKind, types.MakeCompoundType(types.RefKind, types.MakeType(ref.Ref{}, 0))), false},
			},
			types.Choices{},
		),
	}, []ref.Ref{})
	__datasPackageInFile_types_CachedRef = types.RegisterPackage(&p)
}
开发者ID:arv,项目名称:noms-old,代码行数:15,代码来源:types.noms.go


示例11: init

// This function builds up a Noms value that describes the type
// package implemented by this file and registers it with the global
// type package definition cache.
func init() {
	p := types.NewPackage([]types.Type{
		types.MakeStructType("Pitch",
			[]types.Field{
				types.Field{"X", types.MakePrimitiveType(types.Float64Kind), false},
				types.Field{"Z", types.MakePrimitiveType(types.Float64Kind), false},
			},
			types.Choices{},
		),
	}, []ref.Ref{})
	__mainPackageInFile_types_CachedRef = types.RegisterPackage(&p)
}
开发者ID:arv,项目名称:noms-old,代码行数:15,代码来源:types.noms.go


示例12: init

// This function builds up a Noms value that describes the type
// package implemented by this file and registers it with the global
// type package definition cache.
func init() {
	p := types.NewPackage([]types.Type{
		types.MakeStructType("OptionalStruct",
			[]types.Field{
				types.Field{"s", types.MakePrimitiveType(types.StringKind), true},
				types.Field{"b", types.MakePrimitiveType(types.BoolKind), true},
			},
			types.Choices{},
		),
	}, []ref.Ref{})
	__genPackageInFile_struct_optional_CachedRef = types.RegisterPackage(&p)
}
开发者ID:arv,项目名称:noms-old,代码行数:15,代码来源:struct_optional.noms.go


示例13: init

// This function builds up a Noms value that describes the type
// package implemented by this file and registers it with the global
// type package definition cache.
func init() {
	p := types.NewPackage([]types.Type{
		types.MakeStructType("S",
			[]types.Field{
				types.Field{"s", types.MakePrimitiveType(types.StringKind), false},
				types.Field{"b", types.MakePrimitiveType(types.BoolKind), false},
			},
			types.Choices{},
		),
		types.MakeEnumType("E", "e1", "e2", "e3"),
	}, []ref.Ref{})
	__leafDepPackageInFile_leafDep_CachedRef = types.RegisterPackage(&p)
}
开发者ID:arv,项目名称:noms-old,代码行数:16,代码来源:leafDep.noms.go


示例14: init

// This function builds up a Noms value that describes the type
// package implemented by this file and registers it with the global
// type package definition cache.
func init() {
	p := types.NewPackage([]types.Type{
		types.MakeEnumType("LocalE", "LocalE1", "Ignored"),
		types.MakeStructType("ImportUser",
			[]types.Field{
				types.Field{"importedStruct", types.MakeType(ref.Parse("sha1-eda4273cba9d5d4a1bccf41bcaec64743863cde0"), 0), false},
				types.Field{"enum", types.MakeType(ref.Ref{}, 0), false},
			},
			types.Choices{},
		),
	}, []ref.Ref{
		ref.Parse("sha1-eda4273cba9d5d4a1bccf41bcaec64743863cde0"),
	})
	__genPackageInFile_struct_with_imports_CachedRef = types.RegisterPackage(&p)
}
开发者ID:arv,项目名称:noms-old,代码行数:18,代码来源:struct_with_imports.noms.go


示例15: init

// This function builds up a Noms value that describes the type
// package implemented by this file and registers it with the global
// type package definition cache.
func init() {
	p := types.NewPackage([]types.Type{
		types.MakeStructType("Song",
			[]types.Field{
				types.Field{"Title", types.MakePrimitiveType(types.StringKind), false},
				types.Field{"Artist", types.MakePrimitiveType(types.StringKind), false},
				types.Field{"Album", types.MakePrimitiveType(types.StringKind), false},
				types.Field{"Year", types.MakePrimitiveType(types.StringKind), false},
				types.Field{"Mp3", types.MakePrimitiveType(types.BlobKind), false},
			},
			types.Choices{},
		),
	}, []ref.Ref{})
	__mainPackageInFile_types_CachedRef = types.RegisterPackage(&p)
}
开发者ID:arv,项目名称:noms-old,代码行数:18,代码来源:types.noms.go


示例16: init

// This function builds up a Noms value that describes the type
// package implemented by this file and registers it with the global
// type package definition cache.
func init() {
	p := types.NewPackage([]types.Type{
		types.MakeStructType("User",
			[]types.Field{
				types.Field{"Id", types.MakePrimitiveType(types.StringKind), false},
				types.Field{"Name", types.MakePrimitiveType(types.StringKind), false},
				types.Field{"Photos", types.MakeCompoundType(types.SetKind, types.MakeCompoundType(types.RefKind, types.MakeType(ref.Parse("sha1-10004087fdbc623873c649d28aa59f4e066d374e"), 0))), false},
			},
			types.Choices{},
		),
	}, []ref.Ref{
		ref.Parse("sha1-10004087fdbc623873c649d28aa59f4e066d374e"),
	})
	__mainPackageInFile_facebook_CachedRef = types.RegisterPackage(&p)
}
开发者ID:arv,项目名称:noms-old,代码行数:18,代码来源:facebook.noms.go


示例17: init

// This function builds up a Noms value that describes the type
// package implemented by this file and registers it with the global
// type package definition cache.
func init() {
	p := types.NewPackage([]types.Type{
		types.MakeStructType("Import",
			[]types.Field{
				types.Field{"FileSHA1", types.MakePrimitiveType(types.StringKind), false},
				types.Field{"Date", types.MakeType(ref.Parse("sha1-0b4ac7cb0583d7fecd71a1584a3f846e5d8b08eb"), 0), false},
				types.Field{"Companies", types.MakeCompoundType(types.RefKind, types.MakeCompoundType(types.MapKind, types.MakePrimitiveType(types.StringKind), types.MakeCompoundType(types.RefKind, types.MakeType(ref.Parse("sha1-91ae65b19b4817fc15d4e2c5c7472c68b4950b77"), 0)))), false},
			},
			types.Choices{},
		),
	}, []ref.Ref{
		ref.Parse("sha1-0b4ac7cb0583d7fecd71a1584a3f846e5d8b08eb"),
		ref.Parse("sha1-91ae65b19b4817fc15d4e2c5c7472c68b4950b77"),
	})
	__mainPackageInFile_sha1_6c64b08_CachedRef = types.RegisterPackage(&p)
}
开发者ID:arv,项目名称:noms-old,代码行数:19,代码来源:sha1_6c64b08.go


示例18: init

// This function builds up a Noms value that describes the type
// package implemented by this file and registers it with the global
// type package definition cache.
func init() {
	p := types.NewPackage([]types.Type{
		types.MakeStructType("StructWithUnionField",
			[]types.Field{
				types.Field{"a", types.MakePrimitiveType(types.Float32Kind), false},
			},
			types.Choices{
				types.Field{"b", types.MakePrimitiveType(types.Float64Kind), false},
				types.Field{"c", types.MakePrimitiveType(types.StringKind), false},
				types.Field{"d", types.MakePrimitiveType(types.BlobKind), false},
				types.Field{"e", types.MakePrimitiveType(types.ValueKind), false},
				types.Field{"f", types.MakeCompoundType(types.SetKind, types.MakePrimitiveType(types.Uint8Kind)), false},
			},
		),
	}, []ref.Ref{})
	__genPackageInFile_struct_with_union_field_CachedRef = types.RegisterPackage(&p)
}
开发者ID:arv,项目名称:noms-old,代码行数:20,代码来源:struct_with_union_field.noms.go


示例19: init

// This function builds up a Noms value that describes the type
// package implemented by this file and registers it with the global
// type package definition cache.
func init() {
	p := types.NewPackage([]types.Type{
		types.MakeStructType("Geoposition",
			[]types.Field{
				types.Field{"Latitude", types.MakePrimitiveType(types.Float32Kind), false},
				types.Field{"Longitude", types.MakePrimitiveType(types.Float32Kind), false},
			},
			types.Choices{},
		),
		types.MakeStructType("Georectangle",
			[]types.Field{
				types.Field{"TopLeft", types.MakeType(ref.Ref{}, 0), false},
				types.Field{"BottomRight", types.MakeType(ref.Ref{}, 0), false},
			},
			types.Choices{},
		),
	}, []ref.Ref{})
	__commonPackageInFile_geo_CachedRef = types.RegisterPackage(&p)
}
开发者ID:arv,项目名称:noms-old,代码行数:22,代码来源:geo.noms.go


示例20: init

// This function builds up a Noms value that describes the type
// package implemented by this file and registers it with the global
// type package definition cache.
func init() {
	p := types.NewPackage([]types.Type{
		types.MakeStructType("D",
			[]types.Field{
				types.Field{"structField", types.MakeType(ref.Parse("sha1-1c216c6f1d6989e4ede5f78b7689214948dabeef"), 0), false},
				types.Field{"enumField", types.MakeType(ref.Parse("sha1-1c216c6f1d6989e4ede5f78b7689214948dabeef"), 1), false},
			},
			types.Choices{},
		),
		types.MakeStructType("DUser",
			[]types.Field{
				types.Field{"Dfield", types.MakeType(ref.Ref{}, 0), false},
			},
			types.Choices{},
		),
	}, []ref.Ref{
		ref.Parse("sha1-1c216c6f1d6989e4ede5f78b7689214948dabeef"),
	})
	__genPackageInFile_sha1_eda4273_CachedRef = types.RegisterPackage(&p)
}
开发者ID:arv,项目名称:noms-old,代码行数:23,代码来源:sha1_eda4273.go



注:本文中的github.com/attic-labs/noms/types.RegisterPackage函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Golang types.RegisterStruct函数代码示例发布时间:2022-05-24
下一篇:
Golang types.NewTypedList函数代码示例发布时间:2022-05-24
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap