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

Function main

_examples/database/sqlx/main.go:25–52  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

23)
24
25func main() {
26 app := iris.New()
27
28 db := mustConnectDB()
29 mustCreateExtensions(context.Background(), db)
30 mustCreateTables(context.Background(), db)
31
32 app.Post("/", insert(db))
33 app.Get("/", list(db))
34 app.Get("/{event_id:uuid}", getByID(db))
35
36 /*
37 curl --location --request POST 'http://localhost:8080' \
38 --header 'Content-Type: application/json' \
39 --data-raw '{
40 "name": "second_test_event",
41 "data": {
42 "key": "value",
43 "year": 2022
44 }
45 }'
46
47 curl --location --request GET 'http://localhost:8080'
48
49 curl --location --request GET 'http://localhost:8080/4fc0363f-1d1f-4a43-8608-5ed266485645'
50 */
51 app.Listen(":8080")
52}
53
54func mustConnectDB() *sql.DB {
55 connString := fmt.Sprintf("host=%s port=%d user=%s password=%s dbname=%s sslmode=disable",

Callers

nothing calls this directly

Calls 10

mustConnectDBFunction · 0.85
mustCreateExtensionsFunction · 0.85
mustCreateTablesFunction · 0.85
insertFunction · 0.85
getByIDFunction · 0.85
NewMethod · 0.80
listFunction · 0.70
PostMethod · 0.65
GetMethod · 0.65
ListenMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…