Documentation
¶
Index ¶
- type Client
- type DatabaseConfig
- func (c *DatabaseConfig[T]) Cleanup() error
- func (c *DatabaseConfig[T]) CreateClient() (*T, error)
- func (c *DatabaseConfig[T]) GetClient() (T, error)
- func (c *DatabaseConfig[T]) Merge(o *DatabaseConfig[T]) error
- func (c *DatabaseConfig[T]) RegisterFlags(f *flag.FlagSet)
- func (c *DatabaseConfig[T]) Validate() error
- func (c *DatabaseConfig[T]) WithClient(client *T)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DatabaseConfig ¶
type DatabaseConfig[T Client] struct { sync.RWMutex Host string `toml:"host"` Database string `toml:"database"` Port string `toml:"port"` Username string `toml:"username"` Password string `toml:"password"` CreateEntClient func(dialect.Driver) T // contains filtered or unexported fields }
TODO: we can probably put this in baseplate if we can figure out how to make ent.Client generic
func (*DatabaseConfig[T]) Cleanup ¶
func (c *DatabaseConfig[T]) Cleanup() error
func (*DatabaseConfig[T]) CreateClient ¶
func (c *DatabaseConfig[T]) CreateClient() (*T, error)
func (*DatabaseConfig[T]) GetClient ¶
func (c *DatabaseConfig[T]) GetClient() (T, error)
func (*DatabaseConfig[T]) Merge ¶
func (c *DatabaseConfig[T]) Merge(o *DatabaseConfig[T]) error
func (*DatabaseConfig[T]) RegisterFlags ¶
func (c *DatabaseConfig[T]) RegisterFlags(f *flag.FlagSet)
func (*DatabaseConfig[T]) Validate ¶
func (c *DatabaseConfig[T]) Validate() error
func (*DatabaseConfig[T]) WithClient ¶
func (c *DatabaseConfig[T]) WithClient(client *T)
set the database client manually. useful when writing tests with an already initialized client.
WARNING: if you use this parameter, be careful to not use CreateClient() as it will overwrite the manually set client. I don't currently have a good solution to get around this.
Click to show internal directories.
Click to hide internal directories.