MCPcopy Create free account
hub / github.com/kataras/iris / mustCreateTables

Function mustCreateTables

_examples/database/sqlx/main.go:78–92  ·  view source on GitHub ↗
(ctx context.Context, db *sql.DB)

Source from the content-addressed store, hash-verified

76}
77
78func mustCreateTables(ctx context.Context, db *sql.DB) {
79 query := `CREATE TABLE IF NOT EXISTS "events" (
80 "id" uuid PRIMARY KEY NOT NULL DEFAULT gen_random_uuid(),
81 "created_at" timestamp(6) DEFAULT now(),
82 "name" text COLLATE "pg_catalog"."default",
83 "data" jsonb
84 );`
85
86 _, err := db.ExecContext(ctx, query)
87 if err != nil {
88 panic(err)
89 }
90
91 sqlx.Register("events", Event{})
92}
93
94type Event struct {
95 ID string `json:"id"`

Callers 1

mainFunction · 0.85

Calls 1

RegisterFunction · 0.92

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…