mirror of
https://github.com/hay-kot/homebox.git
synced 2024-12-23 23:36:30 +00:00
95ab14b866
* format readme * update logo * format html * add logo to docs * repository for document and document tokens * add attachments type and repository * autogenerate types via scripts * use autogenerated types * attachment type updates * add insured and quantity fields for items * implement HasID interface for entities * implement label updates for items * implement service update method * WIP item update client side actions * check err on attachment * finish types for basic items editor * remove unused var * house keeping
68 lines
1.4 KiB
Go
68 lines
1.4 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(...interface{})
|
|
// hooks to execute on mutations.
|
|
hooks *hooks
|
|
}
|
|
|
|
// hooks per client, for fast access.
|
|
type hooks struct {
|
|
Attachment []ent.Hook
|
|
AuthTokens []ent.Hook
|
|
Document []ent.Hook
|
|
DocumentToken []ent.Hook
|
|
Group []ent.Hook
|
|
Item []ent.Hook
|
|
ItemField []ent.Hook
|
|
Label []ent.Hook
|
|
Location []ent.Hook
|
|
User []ent.Hook
|
|
}
|
|
|
|
// 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(...interface{})) 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
|
|
}
|
|
}
|