MCPcopy Create free account
hub / github.com/dolthub/doltgresql / LoadSynopsis

Function LoadSynopsis

testing/generation/command_docs/create_row_tests.go:91–113  ·  view source on GitHub ↗

LoadSynopsis loads the given synopsis from the synopses directory. The synopsis name may be the file name, or the name of the statement (also known as the prefix). Case-insensitive.

(synopsis string)

Source from the content-addressed store, hash-verified

89// LoadSynopsis loads the given synopsis from the synopses directory. The synopsis name may be the file name, or the
90// name of the statement (also known as the prefix). Case-insensitive.
91func LoadSynopsis(synopsis string) (data string, prefix string, err error) {
92 prefix = strings.ToUpper(
93 strings.ReplaceAll(
94 strings.ReplaceAll(
95 synopsis,
96 ".txt",
97 "",
98 ),
99 "_",
100 " ",
101 ),
102 )
103 fileName := strings.ToLower(strings.ReplaceAll(prefix+".txt", " ", "_"))
104 parentFolder, err := GetCommandDocsFolder()
105 if err != nil {
106 return "", "", err
107 }
108 dataBytes, err := parentFolder.ReadFileFromDirectory("synopses", fileName)
109 if err != nil {
110 return "", "", err
111 }
112 return strings.TrimSpace(string(dataBytes)), prefix, nil
113}
114
115// GetRowResults runs the query against a Postgres server and returns the resulting rows.
116func GetRowResults(query string) ([]sql.Row, error) {

Callers

nothing calls this directly

Calls 2

GetCommandDocsFolderFunction · 0.85
ReadFileFromDirectoryMethod · 0.80

Tested by

no test coverage detected