mirror of
https://github.com/dolthub/dolt.git
synced 2026-05-19 19:39:45 -05:00
48 lines
1.0 KiB
Go
48 lines
1.0 KiB
Go
package datas
|
|
|
|
import "github.com/attic-labs/noms/types"
|
|
|
|
var commitType *types.Type
|
|
|
|
const (
|
|
ParentsField = "parents"
|
|
ValueField = "value"
|
|
)
|
|
|
|
func init() {
|
|
structName := "Commit"
|
|
|
|
// struct Commit {
|
|
// parents: Set<Ref<Commit>>
|
|
// value: Value
|
|
// }
|
|
|
|
fieldTypes := types.TypeMap{
|
|
ParentsField: nil,
|
|
ValueField: types.ValueType,
|
|
}
|
|
commitType = types.MakeStructType(structName, fieldTypes)
|
|
commitType.Desc.(types.StructDesc).Fields[ParentsField] = types.MakeSetType(types.MakeRefType(commitType))
|
|
}
|
|
|
|
func NewCommit() types.Struct {
|
|
initialFields := map[string]types.Value{
|
|
ValueField: types.NewString(""),
|
|
ParentsField: types.NewSet(),
|
|
}
|
|
|
|
return types.NewStructWithType(commitType, initialFields)
|
|
}
|
|
|
|
func typeForMapOfStringToRefOfCommit() *types.Type {
|
|
return types.MakeMapType(types.StringType, types.MakeRefType(commitType))
|
|
}
|
|
|
|
func NewMapOfStringToRefOfCommit() types.Map {
|
|
return types.NewMap()
|
|
}
|
|
|
|
func typeForSetOfRefOfCommit() *types.Type {
|
|
return types.MakeSetType(types.MakeRefType(commitType))
|
|
}
|