mirror of
https://github.com/hay-kot/homebox.git
synced 2024-11-27 11:05:39 +00:00
23b5892aef
* introduce scaffold for new models * wip: shoutrrr wrapper (may remove) * update schema files * gen: ent code * gen: migrations * go mod tidy * add group_id to notifier * db migration * new mapper helpers * notifier repo * introduce experimental adapter pattern for hdlrs * refactor adapters to fit more common use cases * new routes for notifiers * update errors to fix validation panic * go tidy * reverse checkbox label display * wip: notifiers UI * use badges instead of text * improve documentation * add scaffold schema reference * remove notifier service * refactor schema folder * support group edges via scaffold * delete test file * include link to API docs * audit and update documentation + improve format * refactor schema edges * refactor * add custom validator * set validate + order fields by name * fix failing tests
90 lines
2.2 KiB
Go
90 lines
2.2 KiB
Go
// Code generated by ent, DO NOT EDIT.
|
|
|
|
package ent
|
|
|
|
import (
|
|
"entgo.io/ent"
|
|
"entgo.io/ent/dialect"
|
|
)
|
|
|
|
// Option function to configure the client.
|
|
type Option func(*config)
|
|
|
|
// Config is the configuration for the client and its builder.
|
|
type config struct {
|
|
// driver used for executing database requests.
|
|
driver dialect.Driver
|
|
// debug enable a debug logging.
|
|
debug bool
|
|
// log used for logging on debug mode.
|
|
log func(...any)
|
|
// hooks to execute on mutations.
|
|
hooks *hooks
|
|
// interceptors to execute on queries.
|
|
inters *inters
|
|
}
|
|
|
|
// hooks and interceptors per client, for fast access.
|
|
type (
|
|
hooks struct {
|
|
Attachment []ent.Hook
|
|
AuthRoles []ent.Hook
|
|
AuthTokens []ent.Hook
|
|
Document []ent.Hook
|
|
Group []ent.Hook
|
|
GroupInvitationToken []ent.Hook
|
|
Item []ent.Hook
|
|
ItemField []ent.Hook
|
|
Label []ent.Hook
|
|
Location []ent.Hook
|
|
MaintenanceEntry []ent.Hook
|
|
Notifier []ent.Hook
|
|
User []ent.Hook
|
|
}
|
|
inters struct {
|
|
Attachment []ent.Interceptor
|
|
AuthRoles []ent.Interceptor
|
|
AuthTokens []ent.Interceptor
|
|
Document []ent.Interceptor
|
|
Group []ent.Interceptor
|
|
GroupInvitationToken []ent.Interceptor
|
|
Item []ent.Interceptor
|
|
ItemField []ent.Interceptor
|
|
Label []ent.Interceptor
|
|
Location []ent.Interceptor
|
|
MaintenanceEntry []ent.Interceptor
|
|
Notifier []ent.Interceptor
|
|
User []ent.Interceptor
|
|
}
|
|
)
|
|
|
|
// Options applies the options on the config object.
|
|
func (c *config) options(opts ...Option) {
|
|
for _, opt := range opts {
|
|
opt(c)
|
|
}
|
|
if c.debug {
|
|
c.driver = dialect.Debug(c.driver, c.log)
|
|
}
|
|
}
|
|
|
|
// Debug enables debug logging on the ent.Driver.
|
|
func Debug() Option {
|
|
return func(c *config) {
|
|
c.debug = true
|
|
}
|
|
}
|
|
|
|
// Log sets the logging function for debug mode.
|
|
func Log(fn func(...any)) Option {
|
|
return func(c *config) {
|
|
c.log = fn
|
|
}
|
|
}
|
|
|
|
// Driver configures the client driver.
|
|
func Driver(driver dialect.Driver) Option {
|
|
return func(c *config) {
|
|
c.driver = driver
|
|
}
|
|
}
|