Documentation
¶
Index ¶
- Variables
- type Config
- type DatabaseBuilder
- type Field
- type InsertBuilder
- type ORM
- func (o *ORM) Close()
- func (o *ORM) Connect() error
- func (o *ORM) CreateDatabase(ctx context.Context, dbName string, useDb bool, ...) (*DatabaseBuilder, error)
- func (o *ORM) DropDatabase(ctx context.Context, dbName string, queryOptions *chconn.QueryOptions) (*DatabaseBuilder, error)
- func (o *ORM) GetConfig() *Config
- func (o *ORM) GetConn() chpool.Pool
- func (o *ORM) GetContext() context.Context
- func (o *ORM) GetDatabaseName() string
- func (o *ORM) Insert(ctx context.Context, model models.Model, queryOptions *chconn.QueryOptions) (models.Model, *InsertBuilder[models.Model], error)
- type TableBuilder
- func (b *TableBuilder[T]) Build() (string, error)
- func (b *TableBuilder[T]) Exec(ctx context.Context) error
- func (b *TableBuilder[T]) ExecContext(ctx context.Context, queryOptions *chconn.QueryOptions, ...) error
- func (b *TableBuilder[T]) GetBuilder() *sql.TableBuilder
- func (b *TableBuilder[T]) SQL() string
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrNoConfigProvided = errors.New("configuration must be provided") ErrNoHostProvided = errors.New("host must be provided") ErrNoPortProvided = errors.New("port must be provided") ErrNoUsernameProvided = errors.New("username must be provided") ErrNoPasswordProvided = errors.New("password must be provided") ErrNoDatabaseProvided = errors.New("database must be provided") )
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { Host string `json:"host" yaml:"host" env:"GCHM_HOST"` Port int `json:"port" yaml:"port" env:"GCHM_PORT"` Username string `json:"username" yaml:"username" env:"GCHM_USERNAME"` Password string `json:"password" yaml:"password" env:"GCHM_PASSWORD"` Database string `json:"database" yaml:"database" env:"GCHM_DATABASE"` SSLMode string `json:"ssl_mode" yaml:"ssl_mode" env:"GCHM_SSL_MODE"` Insecure bool `json:"insecure" yaml:"insecure" env:"GCHM_INSECURE"` }
type DatabaseBuilder ¶
type DatabaseBuilder struct {
// contains filtered or unexported fields
}
func NewCreateDatabase ¶
func NewDropDatabase ¶
func (*DatabaseBuilder) Build ¶
func (b *DatabaseBuilder) Build() (string, error)
func (*DatabaseBuilder) ExecContext ¶
func (b *DatabaseBuilder) ExecContext(ctx context.Context, queryOptions *chconn.QueryOptions) error
func (*DatabaseBuilder) SQL ¶
func (b *DatabaseBuilder) SQL() string
type InsertBuilder ¶
func (*InsertBuilder[T]) Build ¶
func (b *InsertBuilder[T]) Build() (string, error)
func (*InsertBuilder[T]) ExecContext ¶
func (b *InsertBuilder[T]) ExecContext(ctx context.Context, queryOptions *chconn.QueryOptions, columns ...column.ColumnBasic) error
func (*InsertBuilder[T]) SQL ¶
func (b *InsertBuilder[T]) SQL() string
type ORM ¶
type ORM struct {
// contains filtered or unexported fields
}
func (*ORM) CreateDatabase ¶
func (*ORM) DropDatabase ¶
func (*ORM) GetContext ¶
func (*ORM) GetDatabaseName ¶
type TableBuilder ¶
func NewCreateTable ¶
func NewDropTable ¶
func (*TableBuilder[T]) Build ¶
func (b *TableBuilder[T]) Build() (string, error)
func (*TableBuilder[T]) ExecContext ¶
func (b *TableBuilder[T]) ExecContext(ctx context.Context, queryOptions *chconn.QueryOptions, columns ...column.ColumnBasic) error
func (*TableBuilder[T]) GetBuilder ¶
func (b *TableBuilder[T]) GetBuilder() *sql.TableBuilder
func (*TableBuilder[T]) SQL ¶
func (b *TableBuilder[T]) SQL() string
Source Files
¶
Click to show internal directories.
Click to hide internal directories.