mirror of
https://github.com/versia-pub/versia-go.git
synced 2026-03-12 20:19:15 +01:00
feat: add healthcheck endpoint
This commit is contained in:
parent
f619a0b8af
commit
106a20a922
6 changed files with 69 additions and 1 deletions
|
|
@ -1,3 +1,3 @@
|
|||
package ent
|
||||
|
||||
//go:generate go run -mod=mod entgo.io/ent/cmd/ent generate --feature schema/snapshot --feature sql/upsert ./schema
|
||||
//go:generate go run -mod=mod entgo.io/ent/cmd/ent generate --feature schema/snapshot --feature sql/upsert --template ping.tmpl --template get_client.tmpl ./schema
|
||||
|
|
|
|||
9
ent/get_client.go
Normal file
9
ent/get_client.go
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package ent
|
||||
|
||||
import "entgo.io/ent/dialect/sql"
|
||||
|
||||
func (c *Client) GetClient() *sql.Driver {
|
||||
return c.driver.(*sql.Driver)
|
||||
}
|
||||
12
ent/get_client.tmpl
Normal file
12
ent/get_client.tmpl
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
{{/* gotype: entgo.io/ent/entc/gen.Graph */}}
|
||||
|
||||
{{ define "get_client" }}
|
||||
|
||||
{{ $pkg := base $.Config.Package }}
|
||||
{{ template "header" $ }}
|
||||
|
||||
func (c *Client) GetClient() *sql.Driver {
|
||||
return c.driver.(*sql.Driver)
|
||||
}
|
||||
|
||||
{{ end }}
|
||||
10
ent/ping.go
Normal file
10
ent/ping.go
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package ent
|
||||
|
||||
import "entgo.io/ent/dialect/sql"
|
||||
|
||||
func (c *Client) Ping() error {
|
||||
db := c.driver.(*sql.Driver).DB()
|
||||
return db.Ping()
|
||||
}
|
||||
13
ent/ping.tmpl
Normal file
13
ent/ping.tmpl
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
{{/* gotype: entgo.io/ent/entc/gen.Graph */}}
|
||||
|
||||
{{ define "ping" }}
|
||||
|
||||
{{ $pkg := base $.Config.Package }}
|
||||
{{ template "header" $ }}
|
||||
|
||||
func (c *Client) Ping() error {
|
||||
db := c.driver.(*sql.Driver).DB()
|
||||
return db.Ping()
|
||||
}
|
||||
|
||||
{{ end }}
|
||||
Loading…
Add table
Add a link
Reference in a new issue