当前位置: 首页>>代码示例>>Golang>>正文


Golang Value.Ref方法代码示例

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


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

示例1: WriteValue

// WriteValue takes a Value, schedules it to be written it to ds, and returns v.Ref(). v is not guaranteed to be actually written until after a successful Commit().
func (ds *dataStoreCommon) WriteValue(v types.Value) (r types.RefBase) {
	if v == nil {
		return
	}

	targetRef := v.Ref()
	r = types.PrivateRefFromType(targetRef, types.MakeRefType(v.Type()))
	if entry := ds.checkCache(targetRef); entry != nil && entry.Present() {
		return
	}

	// Encoding v causes any child chunks, e.g. internal nodes if v is a meta sequence, to get written. That needs to happen before we try to validate v.
	chunk := types.EncodeValue(v, ds)

	for _, reachable := range v.Chunks() {
		entry := ds.checkCache(reachable.TargetRef())
		d.Chk.True(entry != nil && entry.Present(), "Value to write contains ref %s, which points to a non-existent Value.", reachable.TargetRef())

		// BUG 1121
		// It's possible that entry.Type() will be simply 'Value', but that 'reachable' is actually a properly-typed object -- that is, a Ref to some specific Type. The Chk below would fail, though it's possible that the Type is actually correct. We wouldn't be able to verify without reading it, though, so we'll dig into this later.
		targetType := getTargetType(reachable)
		if targetType.Equals(types.MakePrimitiveType(types.ValueKind)) {
			continue
		}
		d.Chk.True(entry.Type().Equals(targetType), "Value to write contains ref %s, which points to a value of a different type: %+v != %+v", reachable.TargetRef(), entry.Type(), targetType)
	}
	ds.cs.Put(chunk) // TODO: DataStore should manage batching and backgrounding Puts.
	ds.setCache(targetRef, presentChunk(v.Type()))

	return
}
开发者ID:arv,项目名称:noms-old,代码行数:32,代码来源:datastore_common.go

示例2: Equals

func (s SetOfFloat32) Equals(other types.Value) bool {
	return other != nil && __typeForSetOfFloat32.Equals(other.Type()) && s.Ref() == other.Ref()
}
开发者ID:arv,项目名称:noms-old,代码行数:3,代码来源:ref.noms.go

示例3: Equals

func (s __unionOfEOfFloat64AndFOfString) Equals(other types.Value) bool {
	return other != nil && __typeFor__unionOfEOfFloat64AndFOfString.Equals(other.Type()) && s.Ref() == other.Ref()
}
开发者ID:arv,项目名称:noms-old,代码行数:3,代码来源:struct_with_unions.noms.go

示例4: Equals

func (m MapOfStringToRefOfListOfPitch) Equals(other types.Value) bool {
	return other != nil && __typeForMapOfStringToRefOfListOfPitch.Equals(other.Type()) && m.Ref() == other.Ref()
}
开发者ID:arv,项目名称:noms-old,代码行数:3,代码来源:types.noms.go

示例5: Equals

func (r RefOfRemotePhoto) Equals(other types.Value) bool {
	return other != nil && __typeForRefOfRemotePhoto.Equals(other.Type()) && r.Ref() == other.Ref()
}
开发者ID:arv,项目名称:noms-old,代码行数:3,代码来源:facebook.noms.go

示例6: Equals

func (s S) Equals(other types.Value) bool {
	return other != nil && __typeForS.Equals(other.Type()) && s.Ref() == other.Ref()
}
开发者ID:arv,项目名称:noms-old,代码行数:3,代码来源:leafDep.noms.go

示例7: Equals

func (s Georectangle) Equals(other types.Value) bool {
	return other != nil && __typeForGeorectangle.Equals(other.Type()) && s.Ref() == other.Ref()
}
开发者ID:arv,项目名称:noms-old,代码行数:3,代码来源:geo.noms.go

示例8: Equals

func (m MapOfSizeToString) Equals(other types.Value) bool {
	return other != nil && __typeForMapOfSizeToString.Equals(other.Type()) && m.Ref() == other.Ref()
}
开发者ID:arv,项目名称:noms-old,代码行数:3,代码来源:photo.noms.go

示例9: Equals

func (r RefOfMapOfStringToValue) Equals(other types.Value) bool {
	return other != nil && __typeForRefOfMapOfStringToValue.Equals(other.Type()) && r.Ref() == other.Ref()
}
开发者ID:arv,项目名称:noms-old,代码行数:3,代码来源:types.noms.go

示例10: Equals

func (s SetOfRefOfCommit) Equals(other types.Value) bool {
	return other != nil && __typeForSetOfRefOfCommit.Equals(other.Type()) && s.Ref() == other.Ref()
}
开发者ID:arv,项目名称:noms-old,代码行数:3,代码来源:types.noms.go

示例11: Equals

func (s ImportUser) Equals(other types.Value) bool {
	return other != nil && __typeForImportUser.Equals(other.Type()) && s.Ref() == other.Ref()
}
开发者ID:arv,项目名称:noms-old,代码行数:3,代码来源:struct_with_imports.noms.go

示例12: Equals

func (m MapOfStringToRefOfCompany) Equals(other types.Value) bool {
	return other != nil && __typeForMapOfStringToRefOfCompany.Equals(other.Type()) && m.Ref() == other.Ref()
}
开发者ID:arv,项目名称:noms-old,代码行数:3,代码来源:sha1_6c64b08.go

示例13: Equals

func (m MapOfRefOfKeyToSetOfRefOfRound) Equals(other types.Value) bool {
	return other != nil && __typeForMapOfRefOfKeyToSetOfRefOfRound.Equals(other.Type()) && m.Ref() == other.Ref()
}
开发者ID:arv,项目名称:noms-old,代码行数:3,代码来源:index.noms.go

示例14: Equals

func (s EnumStruct) Equals(other types.Value) bool {
	return other != nil && __typeForEnumStruct.Equals(other.Type()) && s.Ref() == other.Ref()
}
开发者ID:arv,项目名称:noms-old,代码行数:3,代码来源:enum_struct.noms.go

示例15: Equals

func (s StructWithList) Equals(other types.Value) bool {
	return other != nil && __typeForStructWithList.Equals(other.Type()) && s.Ref() == other.Ref()
}
开发者ID:arv,项目名称:noms-old,代码行数:3,代码来源:struct_with_list.noms.go


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