MCPcopy Create free account
hub / github.com/bytebase/bytebase / ParseGhostDirective

Function ParseGhostDirective

backend/component/ghost/directive.go:15–27  ·  view source on GitHub ↗

ParseGhostDirective extracts ghost configuration from sheet content. Returns nil if no ghost directive is found.

(content string)

Source from the content-addressed store, hash-verified

13// ParseGhostDirective extracts ghost configuration from sheet content.
14// Returns nil if no ghost directive is found.
15func ParseGhostDirective(content string) (map[string]string, error) {
16 match := ghostDirectiveRegex.FindStringSubmatch(content)
17 if len(match) < 2 {
18 return nil, nil
19 }
20
21 var flags map[string]string
22 if err := json.Unmarshal([]byte(match[1]), &flags); err != nil {
23 return nil, err
24 }
25
26 return flags, nil
27}
28
29// IsGhostEnabled checks if ghost is enabled by checking for directive presence.
30func IsGhostEnabled(content string) bool {

Callers 4

executeGhostMigrationFunction · 0.92
DeriveCheckTargetsFunction · 0.92
TestParseGhostDirectiveFunction · 0.85

Calls 1

UnmarshalMethod · 0.80

Tested by 1

TestParseGhostDirectiveFunction · 0.68