Documentation
¶
Index ¶
- Variables
- func Apply(draft *models.ProjectSchema, op *Operation) error
- func BoolPayload(args map[string]interface{}, key string) (bool, bool)
- func ChangesetID(projectID string) string
- func ClassifyFieldChange(before, after *models.FieldInfo) (impact string, changes []string)
- func CloneFieldInfo(f *models.FieldInfo) (*models.FieldInfo, error)
- func ComputeDiff(active, draft *models.ProjectSchema) *models.SchemaDiff
- func ConnKeySet(conns []*models.ConnectionType) map[string]*models.ConnectionType
- func ConnectionIdentity(c *models.ConnectionType) string
- func DiffRequiresPhysicalDDL(d *models.SchemaDiff) bool
- func DraftCreateConnection(draft *models.ProjectSchema, op *Operation) error
- func EncodeDiff(d *models.SchemaDiff) string
- func FieldChangeSummary(fc *models.SchemaFieldChange) string
- func FieldMap(fields []*models.FieldInfo) map[string]*models.FieldInfo
- func FindConnection(conns []*models.ConnectionType, peer, knownAs string) *models.ConnectionType
- func FindFieldByIdentifier(fields []*models.FieldInfo, id string) *models.FieldInfo
- func FindFieldByIdentifierDeep(fields []*models.FieldInfo, id string) *models.FieldInfo
- func FindModel(schema *models.ProjectSchema, name string) *models.ModelType
- func ForwardEdges(schema *models.ProjectSchema) map[string]ForwardEdge
- func LabelToIdentifier(label, fieldType string) string
- func OperationSummary(opType string, args map[string]interface{}) string
- func Plan(projectID, changesetID string, ops []Op) []map[string]interface{}
- func Remove(projectID string) error
- func Replay(live *models.ProjectSchema, ops []Op) (*models.ProjectSchema, error)
- func ReplayOperations(base *models.ProjectSchema, ops []*Operation) (*models.ProjectSchema, error)
- func StringArg(args map[string]interface{}, key string) string
- func StringList(args map[string]interface{}, key string) []string
- func SummarizeDiffImpact(d *models.SchemaDiff)
- func ValidateCreateConnectionAgainstDraft(draft *models.ProjectSchema, op *Operation) error
- type API
- type Capabilities
- type File
- type ForwardEdge
- type Local
- func (l *Local) Approve(ctx context.Context, project *models.Project, changesetID, _, _ string) (map[string]interface{}, error)
- func (l *Local) Diff(_ context.Context, project *models.Project, _ string) (string, error)
- func (l *Local) Discard(_ context.Context, project *models.Project, changesetID string) (bool, error)
- func (l *Local) Events(_ context.Context, project *models.Project, _ string) ([]map[string]interface{}, error)
- func (l *Local) Preview(_ context.Context, project *models.Project, source string, _ int) (string, error)
- func (l *Local) Records(_ context.Context, project *models.Project, changesetID string, ...) ([]map[string]interface{}, error)
- func (l *Local) Status(_ context.Context, project *models.Project) (map[string]interface{}, error)
- type Op
- type Operation
- type Publisher
Constants ¶
This section is empty.
Variables ¶
var ErrConnectionAlreadyInDraft = fmt.Errorf("connection already exists in draft")
var RootDir string
RootDir overrides ~/.apito/schema-drafts in tests.
Functions ¶
func ChangesetID ¶
ChangesetID is stable for a project so the console can refetch the same draft.
func ClassifyFieldChange ¶
ClassifyFieldChange compares two fields with the same identifier.
func ComputeDiff ¶
func ComputeDiff(active, draft *models.ProjectSchema) *models.SchemaDiff
func ConnKeySet ¶
func ConnKeySet(conns []*models.ConnectionType) map[string]*models.ConnectionType
func ConnectionIdentity ¶
func ConnectionIdentity(c *models.ConnectionType) string
func DiffRequiresPhysicalDDL ¶
func DiffRequiresPhysicalDDL(d *models.SchemaDiff) bool
func DraftCreateConnection ¶
func DraftCreateConnection(draft *models.ProjectSchema, op *Operation) error
func EncodeDiff ¶
func EncodeDiff(d *models.SchemaDiff) string
EncodeDiff serializes a schema diff for the GraphQL string field.
func FieldChangeSummary ¶
func FieldChangeSummary(fc *models.SchemaFieldChange) string
func FindConnection ¶
func FindConnection(conns []*models.ConnectionType, peer, knownAs string) *models.ConnectionType
func FindFieldByIdentifier ¶
func ForwardEdges ¶
func ForwardEdges(schema *models.ProjectSchema) map[string]ForwardEdge
func LabelToIdentifier ¶
func OperationSummary ¶
func Plan ¶
Plan builds the pending execution rows the Schema Changes table groups by operation. Public rows stay pending until synchronous publish. They are not a Cloud repair ledger.
func Replay ¶
func Replay(live *models.ProjectSchema, ops []Op) (*models.ProjectSchema, error)
Replay applies staged file operations with the same replay Cloud uses. create_model and add_model are one step. The local preview drops an unconnected users model.
func ReplayOperations ¶
func ReplayOperations(base *models.ProjectSchema, ops []*Operation) (*models.ProjectSchema, error)
func StringList ¶
func SummarizeDiffImpact ¶
func SummarizeDiffImpact(d *models.SchemaDiff)
func ValidateCreateConnectionAgainstDraft ¶
func ValidateCreateConnectionAgainstDraft(draft *models.ProjectSchema, op *Operation) error
validateCreateConnectionAgainstDraft enforces draft-side prerequisites for staging create_connection (versioning path skips open-core live-schema defaultFn).
Types ¶
type API ¶
type API interface {
Status(ctx context.Context, project *models.Project) (map[string]interface{}, error)
Preview(ctx context.Context, project *models.Project, source string, version int) (string, error)
Diff(ctx context.Context, project *models.Project, changesetID string) (string, error)
Events(ctx context.Context, project *models.Project, changesetID string) ([]map[string]interface{}, error)
Records(ctx context.Context, project *models.Project, changesetID string, version, limit, offset int) ([]map[string]interface{}, error)
Approve(ctx context.Context, project *models.Project, changesetID, message, actor string) (map[string]interface{}, error)
Discard(ctx context.Context, project *models.Project, changesetID string) (bool, error)
}
API is the pending-draft surface both engines implement. History, revert, review, repair, and remote sync stay outside this interface.
type Capabilities ¶
type Capabilities struct {
History bool `json:"history"`
Collaboration bool `json:"collaboration"`
Revert bool `json:"revert"`
Repair bool `json:"repair"`
RemoteSync bool `json:"remote_sync"`
AsyncPublish bool `json:"async_publish"`
}
Capabilities tells the console which Cloud-only controls to show. The public engine leaves every flag false.
func CloudCapabilities ¶
func CloudCapabilities() Capabilities
CloudCapabilities marks the controls the Cloud console composes around the shared pending panel.
func PublicCapabilities ¶
func PublicCapabilities() Capabilities
PublicCapabilities is the local file-backed draft. Publish is synchronous.
func (Capabilities) Map ¶
func (c Capabilities) Map() map[string]interface{}
type File ¶
type File struct {
ProjectID string `json:"project_id"`
ChangesetID string `json:"changeset_id,omitempty"`
Ops []Op `json:"ops"`
}
File is the on-disk draft. changeset_id is optional so older files still load.
type ForwardEdge ¶
type Local ¶
type Local struct {
Publish Publisher
}
Local is the file-backed pending draft.
type Op ¶
type Op struct {
ID string `json:"id"`
Type string `json:"type"`
Args map[string]interface{} `json:"args"`
CreatedAt string `json:"created_at"`
}
Op is one staged schema mutation. Old draft files use this shape.