yt-gen-app/lib/documentation.go

59 lines
1.5 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package lib
import (
"git.ymnuktech.ru/ymnuk/yt-gen-app/lib/templ"
"git.ymnuktech.ru/ymnuk/yt-gen-app/structs"
"github.com/yuzutech/kroki-go"
)
func Documentation() {
if !AppConfig.IsHtml {
AppConfig.IsMarkdown = true
}
// Генерация общей схемы БД
fullDocDBGen()
// Генерация каждой таблицы по отдельности с прилегающими ближайшими таблицами
/*for i := range Project.DB.Tables {
docDBGen(Project.DB.Tables[i])
}*/
// TODO
}
// Генерирования списка таблиц
/*func listTablesDocGen() string {
// TODO
}
// Генерирование полей таблицы
func tableDocGen(table structs.Table) string {
// TODO
}*/
// Генерация общей схемы БД
func fullDocDBGen() {
// TODO
if tmpl, err := templ.ReadTmplFile("tmpl/docs/db/full-schema.tmpl"); err != nil {
panic(err)
} else {
if buff, err := templ.ExecuteTmplFile(tmpl, Project.DB); err != nil {
panic(err)
} else {
//fmt.Println(string(buff))
templ.WriteFile(AppConfig.OutdirDoc+"/test.txt", buff)
client := NewKrokiClient()
if result, err := client.FromString(string(buff), "dbml", kroki.SVG); err != nil {
panic(err)
} else {
//fmt.Println(result)
templ.WriteFile(AppConfig.OutdirDoc+"/test.svg", []byte(result))
}
}
}
}
// Генерация отдельной таблицы с прилегающими ближайшими таблицами
func docDBGen(table structs.Table) {
// TODO
}