Documentation
¶
Index ¶
- Constants
- func NewRepository[E IEntity]() do.Provider[Repository[E]]
- func NewRepositoryWithDS[E IEntity](dsName string) do.Provider[Repository[E]]
- type Column
- func (exp Column[E]) Between(v1, v2 any) Where[E]
- func (exp Column[E]) GreaterThan(v any) Where[E]
- func (exp Column[E]) GreaterThanEqual(v any) Where[E]
- func (exp Column[E]) IsNull(v any) Where[E]
- func (exp Column[E]) IsTrue(v any) Where[E]
- func (column Column[E]) LessThan(v any) Where[E]
- func (exp Column[E]) LessThanEqual(v any) Where[E]
- func (exp Column[E]) Like(v string) Where[E]
- func (exp Column[E]) NotLike(v string) Where[E]
- func (exp Column[E]) NotNull(v any) Where[E]
- func (exp Column[E]) NotTrue(v any) Where[E]
- func (column Column[E]) Set(v any) Set[E]
- func (column Column[E]) Sql() string
- type DBX
- type Hook
- type Join
- type MustBeStructError
- type Order
- type OrderBy
- type Repository
- type Set
- type SqlBuilder
- func (builder SqlBuilder[E]) Join(joins Join[IEntity, IEntity]) SqlBuilder[E]
- func (builder SqlBuilder[E]) LeftJoin(joins Join[IEntity, IEntity]) SqlBuilder[E]
- func (builder SqlBuilder[E]) Select(cols []Column[IEntity], where Where[IEntity], orders ...OrderBy) (*sql.Row, error)
- func (builder SqlBuilder[E]) Update(sets []Set[E], where Where[IEntity]) (int64, error)
- type Where
Constants ¶
View Source
const DefaultDS = "defaultDS"
Variables ¶
This section is empty.
Functions ¶
func NewRepository ¶
func NewRepository[E IEntity]() do.Provider[Repository[E]]
func NewRepositoryWithDS ¶
func NewRepositoryWithDS[E IEntity](dsName string) do.Provider[Repository[E]]
Types ¶
type Column ¶
func AllColumns ¶
func (Column[E]) GreaterThan ¶
func (Column[E]) GreaterThanEqual ¶
func (Column[E]) LessThanEqual ¶
type DBX ¶
type DBX interface {
ExecContext(context.Context, string, ...interface{}) (sql.Result, error)
PrepareContext(context.Context, string) (*sql.Stmt, error)
QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error)
QueryRowContext(context.Context, string, ...interface{}) *sql.Row
Close() error
}
DBX database adapter
type MustBeStructError ¶
type MustBeStructError struct {
// contains filtered or unexported fields
}
func (MustBeStructError) Error ¶
func (e MustBeStructError) Error() string
type Repository ¶
type Repository[E IEntity] interface {
Insert(entity E) (int64, error)
BatchInsert(entities []E) (int64, error)
Delete(key any) (int64, error)
Update(set []Set[E], where Where[E]) (int64, error)
Find(key any) (E, error)
FindBy(where Where[E]) (E, error)
DeleteBy(where Where[E]) (int64, error)
Select(columns []Column[E], where Where[E], orders ...OrderBy) ([]E, error)
Join(joins []Join[E, IEntity]) SqlBuilder[E]
LeftJoin(joins []Join[E, IEntity]) SqlBuilder[E]
}
type SqlBuilder ¶
type SqlBuilder[E IEntity] struct {
// contains filtered or unexported fields
}
func (SqlBuilder[E]) Join ¶
func (builder SqlBuilder[E]) Join(joins Join[IEntity, IEntity]) SqlBuilder[E]
func (SqlBuilder[E]) LeftJoin ¶
func (builder SqlBuilder[E]) LeftJoin(joins Join[IEntity, IEntity]) SqlBuilder[E]
Click to show internal directories.
Click to hide internal directories.