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)
| 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. |
| 91 | func 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. |
| 116 | func GetRowResults(query string) ([]sql.Row, error) { |
nothing calls this directly
no test coverage detected