mirror of
https://github.com/dolthub/dolt.git
synced 2026-05-19 11:29:41 -05:00
54e4c18806
* primitives.go split into bool.go and number.go, interfaces implemented marked, a few .gitignore files updated * removing old binary names
48 lines
735 B
Go
48 lines
735 B
Go
package types
|
|
|
|
import "github.com/attic-labs/noms/ref"
|
|
|
|
type String struct {
|
|
s string
|
|
ref *ref.Ref
|
|
}
|
|
|
|
func NewString(s string) String {
|
|
return String{s, &ref.Ref{}}
|
|
}
|
|
|
|
func (fs String) String() string {
|
|
return fs.s
|
|
}
|
|
|
|
// Value interface
|
|
func (s String) Equals(other Value) bool {
|
|
if other, ok := other.(String); ok {
|
|
return s.s == other.s
|
|
}
|
|
return false
|
|
}
|
|
|
|
func (s String) Less(other Value) bool {
|
|
if s2, ok := other.(String); ok {
|
|
return s.s < s2.s
|
|
}
|
|
return StringKind < other.Type().Kind()
|
|
}
|
|
|
|
func (fs String) Ref() ref.Ref {
|
|
return EnsureRef(fs.ref, fs)
|
|
}
|
|
|
|
func (fs String) ChildValues() []Value {
|
|
return nil
|
|
}
|
|
|
|
func (fs String) Chunks() []Ref {
|
|
return nil
|
|
}
|
|
|
|
func (fs String) Type() *Type {
|
|
return StringType
|
|
}
|