Documentation ¶
Index ¶
- type Database
- func (d *Database[T]) CommitTransaction() (err error)
- func (d *Database[T]) Create(ctx context.Context, obj T) (T, error)
- func (d *Database[T]) Delete(ctx context.Context, id string) error
- func (d *Database[T]) DeleteHard(ctx context.Context, id string) error
- func (d *Database[T]) Get(ctx context.Context, id string) (t T, err error)
- func (d *Database[T]) List(ctx context.Context, f filter.Filter) (records []T, err error)
- func (d *Database[T]) RollbackTransaction() (err error)
- func (d *Database[T]) Save(ctx context.Context, insert bool, objs ...T) (list []T, err error)
- func (d *Database[T]) Select(ctx context.Context, dest interface{}, query string, args ...interface{}) (err error)
- func (d *Database[T]) StartTransaction() (err error)
- func (d *Database[T]) Update(ctx context.Context, obj T, FieldNames dao.UpdateField) error
- type Doc
- type MigrationModel
- type Options
- type ViolationUniqKey
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Database ¶
func NewDataBase ¶
NewDataBase factory method to create instance of Database struct dbConnection is the database connection used for all operation tenantId is the table will be used to insert data
func (*Database[T]) CommitTransaction ¶
func (*Database[T]) DeleteHard ¶
func (*Database[T]) RollbackTransaction ¶
func (*Database[T]) Save ¶
Save objects whatever is insert or update, based on id the save method decide which operation is
func (*Database[T]) StartTransaction ¶
type MigrationModel ¶
type MigrationModel struct { Id int CreatedAt time.Time `Db:"created_at"` Module string `Db:"module"` Name string `Db:"name"` SQL string }
MigrationModel mode used to manage migrationsSingleton
func NewMigration ¶
func NewMigration(dbName string) *MigrationModel
NewDbMigration factory method to create a new instance of MigrationModel
func (*MigrationModel) GetMigrationNumber ¶
func (m *MigrationModel) GetMigrationNumber() int64
GetMigrationNumber get the current migration number
func (*MigrationModel) TableName ¶
func (m *MigrationModel) TableName() string
TableName is used by the Gorm to define table name
type Options ¶
type Options struct { // FieldSnakeCase set true to convert the fields to snake case before marhsal process FieldSnakeCase bool }
type ViolationUniqKey ¶
type ViolationUniqKey struct { FieldName string Value string // contains filtered or unexported fields }
func (ViolationUniqKey) Error ¶
func (v ViolationUniqKey) Error() string
Click to show internal directories.
Click to hide internal directories.