Documentation
¶
Index ¶
- func CastIDToTableName(castID id.Cast) doltdb.TableName
- func Init() map[id.Cast]Cast
- type Cast
- func (cast Cast) Eval(ctx *sql.Context, val any, sourceType *pgtypes.DoltgresType, ...) (any, error)
- func (cast Cast) GetID() id.Id
- func (cast Cast) GetRootObjectID() objinterface.RootObjectID
- func (cast Cast) HashOf(ctx context.Context) (hash.Hash, error)
- func (cast Cast) Name() doltdb.TableName
- func (cast Cast) Serialize(ctx context.Context) ([]byte, error)
- type CastType
- type Collection
- func (pgc *Collection) AddCast(ctx context.Context, cast Cast) error
- func (pgc *Collection) Clone(ctx context.Context) *Collection
- func (pgc *Collection) DeserializeRootObject(ctx context.Context, data []byte) (objinterface.RootObject, error)
- func (pgc *Collection) DiffRootObjects(ctx context.Context, fromHash string, ours objinterface.RootObject, ...) ([]objinterface.RootObjectDiff, objinterface.RootObject, error)
- func (pgc *Collection) DiffersFrom(ctx context.Context, root objinterface.RootValue) bool
- func (pgc *Collection) DropCast(ctx context.Context, castIDs ...id.Cast) error
- func (pgc *Collection) DropRootObject(ctx context.Context, identifier id.Id) error
- func (pgc *Collection) GetAssignmentCast(ctx *sql.Context, sourceType *pgtypes.DoltgresType, ...) (Cast, error)
- func (pgc *Collection) GetExplicitCast(ctx *sql.Context, sourceType *pgtypes.DoltgresType, ...) (Cast, error)
- func (pgc *Collection) GetFieldType(ctx context.Context, fieldName string) *pgtypes.DoltgresType
- func (pgc *Collection) GetID() objinterface.RootObjectID
- func (pgc *Collection) GetImplicitCast(ctx *sql.Context, sourceType *pgtypes.DoltgresType, ...) (Cast, error)
- func (pgc *Collection) GetRootObject(ctx context.Context, identifier id.Id) (objinterface.RootObject, bool, error)
- func (*Collection) HandleMerge(ctx context.Context, mro merge.MergeRootObject) (doltdb.RootObject, *merge.MergeStats, error)
- func (pgc *Collection) HasCast(ctx context.Context, castID id.Cast) bool
- func (pgc *Collection) HasRootObject(ctx context.Context, identifier id.Id) (bool, error)
- func (pgc *Collection) IDToTableName(identifier id.Id) doltdb.TableName
- func (pgc *Collection) IterAll(ctx context.Context, ...) error
- func (pgc *Collection) IterIDs(ctx context.Context, callback func(identifier id.Id) (stop bool, err error)) error
- func (pgc *Collection) IterateCasts(ctx context.Context, callback func(c Cast) (stop bool, err error)) error
- func (*Collection) LoadCollection(ctx context.Context, root objinterface.RootValue) (objinterface.Collection, error)
- func (*Collection) LoadCollectionHash(ctx context.Context, root objinterface.RootValue) (hash.Hash, error)
- func (pgc *Collection) Map(ctx context.Context) (prolly.AddressMap, error)
- func (pgc *Collection) PutRootObject(ctx context.Context, rootObj objinterface.RootObject) error
- func (pgc *Collection) RenameRootObject(ctx context.Context, oldName id.Id, newName id.Id) error
- func (pgc *Collection) ResolveName(ctx context.Context, name doltdb.TableName) (doltdb.TableName, id.Id, error)
- func (*Collection) ResolveNameFromObjects(ctx context.Context, name doltdb.TableName, ...) (doltdb.TableName, id.Id, error)
- func (*Collection) Serializer() objinterface.RootObjectSerializer
- func (pgc *Collection) TableNameToID(name doltdb.TableName) id.Id
- func (pgc *Collection) UpdateField(ctx context.Context, rootObject objinterface.RootObject, fieldName string, ...) (objinterface.RootObject, error)
- func (pgc *Collection) UpdateRoot(ctx context.Context, root objinterface.RootValue) (objinterface.RootValue, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CastIDToTableName ¶
CastIDToTableName returns the ID in a format that's better for user consumption.
Types ¶
type Cast ¶
type Cast struct {
ID id.Cast
CastType CastType
Function id.Function
BuiltIn pgtypes.TypeCastFunction
UseInOut bool
}
Cast represents a cast between two types.
func DeserializeCast ¶
DeserializeCast returns the Cast that was serialized in the byte slice. Returns an empty Cast (invalid ID) if data is nil or empty.
func (Cast) Eval ¶
func (cast Cast) Eval(ctx *sql.Context, val any, sourceType *pgtypes.DoltgresType, targetType *pgtypes.DoltgresType) (any, error)
Eval evaluates the cast against the given value.
func (Cast) GetRootObjectID ¶
func (cast Cast) GetRootObjectID() objinterface.RootObjectID
GetRootObjectID implements the interface objinterface.RootObject.
type CastType ¶
type CastType uint8
CastType is the type of the cast, indicating which contexts it may be called in.
type Collection ¶
type Collection struct {
// contains filtered or unexported fields
}
Collection contains a collection of casts.
func LoadCasts ¶
func LoadCasts(ctx context.Context, root objinterface.RootValue) (*Collection, error)
LoadCasts loads the casts collection from the given root.
func NewCollection ¶
func NewCollection(ctx context.Context, underlyingMap prolly.AddressMap, ns tree.NodeStore) (*Collection, error)
NewCollection returns a new Collection.
func (*Collection) AddCast ¶
func (pgc *Collection) AddCast(ctx context.Context, cast Cast) error
AddCast adds a new cast.
func (*Collection) Clone ¶
func (pgc *Collection) Clone(ctx context.Context) *Collection
Clone returns a new *Collection with the same contents as the original.
func (*Collection) DeserializeRootObject ¶
func (pgc *Collection) DeserializeRootObject(ctx context.Context, data []byte) (objinterface.RootObject, error)
DeserializeRootObject implements the interface objinterface.Collection.
func (*Collection) DiffRootObjects ¶
func (pgc *Collection) DiffRootObjects(ctx context.Context, fromHash string, ours objinterface.RootObject, theirs objinterface.RootObject, ancestor objinterface.RootObject) ([]objinterface.RootObjectDiff, objinterface.RootObject, error)
DiffRootObjects implements the interface objinterface.Collection.
func (*Collection) DiffersFrom ¶
func (pgc *Collection) DiffersFrom(ctx context.Context, root objinterface.RootValue) bool
DiffersFrom returns true when the hash that is associated with the underlying map for this collection is different from the hash in the given root.
func (*Collection) DropRootObject ¶
DropRootObject implements the interface objinterface.Collection.
func (*Collection) GetAssignmentCast ¶
func (pgc *Collection) GetAssignmentCast(ctx *sql.Context, sourceType *pgtypes.DoltgresType, targetType *pgtypes.DoltgresType) (Cast, error)
GetAssignmentCast returns the assignment type cast function that will cast the source type to the target type. Returns a Cast with an invalid ID if such a cast is not valid.
func (*Collection) GetExplicitCast ¶
func (pgc *Collection) GetExplicitCast(ctx *sql.Context, sourceType *pgtypes.DoltgresType, targetType *pgtypes.DoltgresType) (Cast, error)
GetExplicitCast returns the explicit type cast function that will cast the source type to the target type. Returns a Cast with an invalid ID if such a cast is not valid.
func (*Collection) GetFieldType ¶
func (pgc *Collection) GetFieldType(ctx context.Context, fieldName string) *pgtypes.DoltgresType
GetFieldType implements the interface objinterface.Collection.
func (*Collection) GetID ¶
func (pgc *Collection) GetID() objinterface.RootObjectID
GetID implements the interface objinterface.Collection.
func (*Collection) GetImplicitCast ¶
func (pgc *Collection) GetImplicitCast(ctx *sql.Context, sourceType *pgtypes.DoltgresType, targetType *pgtypes.DoltgresType) (Cast, error)
GetImplicitCast returns the implicit type cast function that will cast the source type to the target type. Returns a Cast with an invalid ID if such a cast is not valid.
func (*Collection) GetRootObject ¶
func (pgc *Collection) GetRootObject(ctx context.Context, identifier id.Id) (objinterface.RootObject, bool, error)
GetRootObject implements the interface objinterface.Collection.
func (*Collection) HandleMerge ¶
func (*Collection) HandleMerge(ctx context.Context, mro merge.MergeRootObject) (doltdb.RootObject, *merge.MergeStats, error)
HandleMerge implements the interface objinterface.Collection.
func (*Collection) HasRootObject ¶
HasRootObject implements the interface objinterface.Collection.
func (*Collection) IDToTableName ¶
func (pgc *Collection) IDToTableName(identifier id.Id) doltdb.TableName
IDToTableName implements the interface objinterface.Collection.
func (*Collection) IterAll ¶
func (pgc *Collection) IterAll(ctx context.Context, callback func(rootObj objinterface.RootObject) (stop bool, err error)) error
IterAll implements the interface objinterface.Collection.
func (*Collection) IterIDs ¶
func (pgc *Collection) IterIDs(ctx context.Context, callback func(identifier id.Id) (stop bool, err error)) error
IterIDs implements the interface objinterface.Collection.
func (*Collection) IterateCasts ¶
func (pgc *Collection) IterateCasts(ctx context.Context, callback func(c Cast) (stop bool, err error)) error
IterateCasts iterates over all casts in the collection.
func (*Collection) LoadCollection ¶
func (*Collection) LoadCollection(ctx context.Context, root objinterface.RootValue) (objinterface.Collection, error)
LoadCollection implements the interface objinterface.Collection.
func (*Collection) LoadCollectionHash ¶
func (*Collection) LoadCollectionHash(ctx context.Context, root objinterface.RootValue) (hash.Hash, error)
LoadCollectionHash implements the interface objinterface.Collection.
func (*Collection) Map ¶
func (pgc *Collection) Map(ctx context.Context) (prolly.AddressMap, error)
Map writes any cached sequences to the underlying map, and then returns the underlying map.
func (*Collection) PutRootObject ¶
func (pgc *Collection) PutRootObject(ctx context.Context, rootObj objinterface.RootObject) error
PutRootObject implements the interface objinterface.Collection.
func (*Collection) RenameRootObject ¶
RenameRootObject implements the interface objinterface.Collection.
func (*Collection) ResolveName ¶
func (pgc *Collection) ResolveName(ctx context.Context, name doltdb.TableName) (doltdb.TableName, id.Id, error)
ResolveName implements the interface objinterface.Collection.
func (*Collection) ResolveNameFromObjects ¶
func (*Collection) ResolveNameFromObjects(ctx context.Context, name doltdb.TableName, rootObjects []objinterface.RootObject) (doltdb.TableName, id.Id, error)
ResolveNameFromObjects implements the interface objinterface.Collection.
func (*Collection) Serializer ¶
func (*Collection) Serializer() objinterface.RootObjectSerializer
Serializer implements the interface objinterface.Collection.
func (*Collection) TableNameToID ¶
func (pgc *Collection) TableNameToID(name doltdb.TableName) id.Id
TableNameToID implements the interface objinterface.Collection.
func (*Collection) UpdateField ¶
func (pgc *Collection) UpdateField(ctx context.Context, rootObject objinterface.RootObject, fieldName string, newValue any) (objinterface.RootObject, error)
UpdateField implements the interface objinterface.Collection.
func (*Collection) UpdateRoot ¶
func (pgc *Collection) UpdateRoot(ctx context.Context, root objinterface.RootValue) (objinterface.RootValue, error)
UpdateRoot implements the interface objinterface.Collection.