本文整理汇总了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
}
示例2: Equals
func (s SetOfFloat32) Equals(other types.Value) bool {
return other != nil && __typeForSetOfFloat32.Equals(other.Type()) && s.Ref() == other.Ref()
}
示例3: Equals
func (s __unionOfEOfFloat64AndFOfString) Equals(other types.Value) bool {
return other != nil && __typeFor__unionOfEOfFloat64AndFOfString.Equals(other.Type()) && s.Ref() == other.Ref()
}
示例4: Equals
func (m MapOfStringToRefOfListOfPitch) Equals(other types.Value) bool {
return other != nil && __typeForMapOfStringToRefOfListOfPitch.Equals(other.Type()) && m.Ref() == other.Ref()
}
示例5: Equals
func (r RefOfRemotePhoto) Equals(other types.Value) bool {
return other != nil && __typeForRefOfRemotePhoto.Equals(other.Type()) && r.Ref() == other.Ref()
}
示例6: Equals
func (s S) Equals(other types.Value) bool {
return other != nil && __typeForS.Equals(other.Type()) && s.Ref() == other.Ref()
}
示例7: Equals
func (s Georectangle) Equals(other types.Value) bool {
return other != nil && __typeForGeorectangle.Equals(other.Type()) && s.Ref() == other.Ref()
}
示例8: Equals
func (m MapOfSizeToString) Equals(other types.Value) bool {
return other != nil && __typeForMapOfSizeToString.Equals(other.Type()) && m.Ref() == other.Ref()
}
示例9: Equals
func (r RefOfMapOfStringToValue) Equals(other types.Value) bool {
return other != nil && __typeForRefOfMapOfStringToValue.Equals(other.Type()) && r.Ref() == other.Ref()
}
示例10: Equals
func (s SetOfRefOfCommit) Equals(other types.Value) bool {
return other != nil && __typeForSetOfRefOfCommit.Equals(other.Type()) && s.Ref() == other.Ref()
}
示例11: Equals
func (s ImportUser) Equals(other types.Value) bool {
return other != nil && __typeForImportUser.Equals(other.Type()) && s.Ref() == other.Ref()
}
示例12: Equals
func (m MapOfStringToRefOfCompany) Equals(other types.Value) bool {
return other != nil && __typeForMapOfStringToRefOfCompany.Equals(other.Type()) && m.Ref() == other.Ref()
}
示例13: Equals
func (m MapOfRefOfKeyToSetOfRefOfRound) Equals(other types.Value) bool {
return other != nil && __typeForMapOfRefOfKeyToSetOfRefOfRound.Equals(other.Type()) && m.Ref() == other.Ref()
}
示例14: Equals
func (s EnumStruct) Equals(other types.Value) bool {
return other != nil && __typeForEnumStruct.Equals(other.Type()) && s.Ref() == other.Ref()
}
示例15: Equals
func (s StructWithList) Equals(other types.Value) bool {
return other != nil && __typeForStructWithList.Equals(other.Type()) && s.Ref() == other.Ref()
}