Files
sonr/internal/dwn/front/scripts/database_templ.go
T

38 lines
1.7 KiB
Go
Raw Normal View History

2024-09-07 18:12:58 -04:00
// Code generated by templ - DO NOT EDIT.
// templ: version: v0.2.771
2024-09-19 19:09:01 -04:00
package scripts
2024-09-07 18:12:58 -04:00
//lint:file-ignore SA4006 This context is only used if a nested component is present.
import "github.com/a-h/templ"
import templruntime "github.com/a-h/templ/runtime"
2024-09-19 19:09:01 -04:00
func InitializeDatabase() templ.Component {
2024-09-07 18:12:58 -04:00
return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
if !templ_7745c5c3_IsBuffer {
defer func() {
templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
if templ_7745c5c3_Err == nil {
templ_7745c5c3_Err = templ_7745c5c3_BufErr
}
}()
}
ctx = templ.InitializeContext(ctx)
templ_7745c5c3_Var1 := templ.GetChildren(ctx)
if templ_7745c5c3_Var1 == nil {
templ_7745c5c3_Var1 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
2024-09-19 19:09:01 -04:00
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<script type=\"module\">\n // Import Dexie\n import { Dexie } from 'https://unpkg.com/dexie/dist/modern/dexie.mjs';\n \n // Create a new Dexie database\n const db = new Dexie('myDatabase');\n \n // Define the schema for the database\n db.version(1).stores({\n users: '++id, name, age',\n posts: '++id, title, content, authorId',\n comments: '++id, content, postId, authorId',\n });\n \n // Export the database instance\n export default db;\n </script>")
2024-09-07 18:12:58 -04:00
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
return templ_7745c5c3_Err
})
}
var _ = templruntime.GeneratedTemplate