Documentation
¶
Index ¶
- func CachePath(name, root, cacheDir string) (string, error)
- func ManagedCacheTables() []string
- func ManagedMutationTables() []string
- func OpenManaged(ctx context.Context, opts Options) (*Managed, *Stats, error)
- func RefreshPublicGraph(ctx context.Context, db *sql.DB) error
- type DBRefTarget
- type Managed
- func (m *Managed) Close() error
- func (m *Managed) ExecuteManagedMutation(ctx context.Context, req MutationRequest) (json.RawMessage, error)
- func (m *Managed) RefreshPublicGraph(ctx context.Context) error
- func (m *Managed) SetDBRefTargets(ctx context.Context, targets []DBRefTarget) error
- func (m *Managed) SetSourceChangeHook(fn func())
- type MutationField
- type MutationRequest
- type MutationRoot
- type Options
- type Stats
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ManagedCacheTables ¶
func ManagedCacheTables() []string
ManagedCacheTables returns the CodeSQL tables whose cached GraphQL query results must be invalidated after source reconciliation.
func ManagedMutationTables ¶
func ManagedMutationTables() []string
ManagedMutationTables returns CodeSQL's service-managed mutation tables.
func OpenManaged ¶
OpenManaged opens or creates the managed SQLite cache, reconciles it with the source root, and optionally starts the runtime watcher.
Types ¶
type DBRefTarget ¶
type Managed ¶
type Managed struct {
DB *sql.DB
CachePath string
Root string
// contains filtered or unexported fields
}
Managed is a live SQLite-backed source-code database.
func (*Managed) ExecuteManagedMutation ¶
func (m *Managed) ExecuteManagedMutation(ctx context.Context, req MutationRequest) (json.RawMessage, error)
ExecuteManagedMutation handles CodeSQL preview/apply/lock GraphQL mutations.
func (*Managed) RefreshPublicGraph ¶
RefreshPublicGraph refreshes the public gj_code facade while serializing against other managed CodeSQL writes.
func (*Managed) SetDBRefTargets ¶
func (m *Managed) SetDBRefTargets(ctx context.Context, targets []DBRefTarget) error
func (*Managed) SetSourceChangeHook ¶
func (m *Managed) SetSourceChangeHook(fn func())
SetSourceChangeHook registers a callback fired after a successful reconcile that changes the indexed source view.
type MutationField ¶
MutationField describes a selected return field.
type MutationRequest ¶
type MutationRequest struct {
Database string
Operation string
Roots []MutationRoot
}
MutationRequest describes GraphQL roots routed to the CodeSQL mutation bridge.
type MutationRoot ¶
type MutationRoot struct {
FieldName string
Table string
Operation string
Input map[string]interface{}
Fields []MutationField
}
MutationRoot describes one managed mutation root.
type Options ¶
type Options struct {
// Name is the GraphJin database config key. It is used as the cache file
// prefix under CacheDir.
Name string
// Root is the source tree to index.
Root string
// CacheDir is normally <graphjin-config>/codesql.
CacheDir string
// Watch starts the runtime fsnotify reconciler after the initial scan.
Watch bool
// InferDBRefs enables best-effort code-to-database reference extraction.
InferDBRefs bool
// RefTargets is an optional database metadata catalog used to resolve refs.
RefTargets []DBRefTarget
}
Options configures a managed CodeSQL index.