mirror of
https://github.com/dolthub/dolt.git
synced 2026-04-28 12:40:16 -05:00
+27
-7
@@ -1,14 +1,34 @@
|
||||
package types
|
||||
|
||||
type String interface {
|
||||
Value
|
||||
import (
|
||||
"github.com/attic-labs/noms/ref"
|
||||
)
|
||||
|
||||
Blob() Blob
|
||||
|
||||
// Slurps the entire string into memory. You obviously don't want to do this if the string might be large.
|
||||
String() string
|
||||
type String struct {
|
||||
s string
|
||||
cr *cachedRef
|
||||
}
|
||||
|
||||
func NewString(s string) String {
|
||||
return flatString{s, &cachedRef{}}
|
||||
return String{s, &cachedRef{}}
|
||||
}
|
||||
|
||||
func (fs String) Blob() Blob {
|
||||
return NewBlob([]byte(fs.s))
|
||||
}
|
||||
|
||||
func (fs String) String() string {
|
||||
return fs.s
|
||||
}
|
||||
|
||||
func (fs String) Ref() ref.Ref {
|
||||
return fs.cr.Ref(fs)
|
||||
}
|
||||
|
||||
func (fs String) Equals(other Value) bool {
|
||||
if other == nil {
|
||||
return false
|
||||
} else {
|
||||
return fs.Ref() == other.Ref()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user