Documentation ¶
Index ¶
- type BaseDatabaseImplement
- func (s *BaseDatabaseImplement) Count(table, query string, args ...any) (count int64, err error)
- func (s *BaseDatabaseImplement) CountWithCtx(ctx context.Context, table, query string, args ...any) (count int64, err error)
- func (s *BaseDatabaseImplement) DeleteAll(query string, args ...any) error
- func (s *BaseDatabaseImplement) DeleteAllWithCtx(ctx context.Context, query string, args ...any) error
- func (s *BaseDatabaseImplement) DeleteOne(query string, args ...any) error
- func (s *BaseDatabaseImplement) DeleteOneWithCtx(ctx context.Context, query string, args ...any) error
- func (s *BaseDatabaseImplement) ExecRaw(sql string, args ...any) error
- func (s *BaseDatabaseImplement) ExecRawWithCtx(ctx context.Context, sql string, args ...any) error
- func (s *BaseDatabaseImplement) GetAll(receiver any, query string, args ...any) error
- func (s *BaseDatabaseImplement) GetAllWithCtx(ctx context.Context, receiver any, query string, args ...any) error
- func (s *BaseDatabaseImplement) GetOne(receiver any, query string, args ...any) error
- func (s *BaseDatabaseImplement) GetOneWithCtx(ctx context.Context, receiver any, query string, args ...any) error
- func (s *BaseDatabaseImplement) GetPage(receiver any, offset, limit int, query string, args ...any) error
- func (s *BaseDatabaseImplement) Has(table, query string, args ...any) (exist bool, err error)
- func (s *BaseDatabaseImplement) HasWithCtx(ctx context.Context, table, query string, args ...any) (exist bool, err error)
- func (s *BaseDatabaseImplement) Init(_ Options) error
- func (s *BaseDatabaseImplement) InsertAll(data any) error
- func (s *BaseDatabaseImplement) InsertAllWithCtx(ctx context.Context, data any) error
- func (s *BaseDatabaseImplement) InsertOne(data any) error
- func (s *BaseDatabaseImplement) InsertOneWithCtx(ctx context.Context, data any) error
- func (s *BaseDatabaseImplement) Migrate(models ...any) error
- func (s *BaseDatabaseImplement) ParseDatabaseOptions(db *sql.DB, opts Options)
- func (s *BaseDatabaseImplement) ParseLoggerOptions(opts Options)
- func (s *BaseDatabaseImplement) PickAll(receiver any, length int, query string, args ...any) error
- func (s *BaseDatabaseImplement) PickAllWithCtx(ctx context.Context, receiver any, length int, query string, args ...any) error
- func (s *BaseDatabaseImplement) PickOne(receiver any, query string, args ...any) error
- func (s *BaseDatabaseImplement) PickOneWithCtx(ctx context.Context, receiver any, query string, args ...any) error
- func (s *BaseDatabaseImplement) QueryRaw(receiver any, sql string, args ...any) error
- func (s *BaseDatabaseImplement) QueryRawWithCtx(ctx context.Context, receiver any, sql string, args ...any) error
- func (s *BaseDatabaseImplement) SetRandCommand(command string)
- func (s *BaseDatabaseImplement) UpdateAll(data any, query string, args ...any) error
- func (s *BaseDatabaseImplement) UpdateAllWithCtx(ctx context.Context, data any, query string, args ...any) error
- func (s *BaseDatabaseImplement) UpdateOne(data any, query string, args ...any) error
- func (s *BaseDatabaseImplement) UpdateOneWithCtx(ctx context.Context, data any, query string, args ...any) error
- type Database
- type Options
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BaseDatabaseImplement ¶
type BaseDatabaseImplement struct { Db *gorm.DB Logger logger.Logger Timeout time.Duration // contains filtered or unexported fields }
func (*BaseDatabaseImplement) Count ¶
func (s *BaseDatabaseImplement) Count(table, query string, args ...any) (count int64, err error)
func (*BaseDatabaseImplement) CountWithCtx ¶
func (*BaseDatabaseImplement) DeleteAll ¶
func (s *BaseDatabaseImplement) DeleteAll(query string, args ...any) error
func (*BaseDatabaseImplement) DeleteAllWithCtx ¶
func (*BaseDatabaseImplement) DeleteOne ¶
func (s *BaseDatabaseImplement) DeleteOne(query string, args ...any) error
func (*BaseDatabaseImplement) DeleteOneWithCtx ¶
func (*BaseDatabaseImplement) ExecRaw ¶
func (s *BaseDatabaseImplement) ExecRaw(sql string, args ...any) error
func (*BaseDatabaseImplement) ExecRawWithCtx ¶
func (*BaseDatabaseImplement) GetAll ¶
func (s *BaseDatabaseImplement) GetAll(receiver any, query string, args ...any) error
func (*BaseDatabaseImplement) GetAllWithCtx ¶
func (*BaseDatabaseImplement) GetOne ¶
func (s *BaseDatabaseImplement) GetOne(receiver any, query string, args ...any) error
func (*BaseDatabaseImplement) GetOneWithCtx ¶
func (*BaseDatabaseImplement) Has ¶
func (s *BaseDatabaseImplement) Has(table, query string, args ...any) (exist bool, err error)
func (*BaseDatabaseImplement) HasWithCtx ¶
func (*BaseDatabaseImplement) Init ¶
func (s *BaseDatabaseImplement) Init(_ Options) error
func (*BaseDatabaseImplement) InsertAll ¶
func (s *BaseDatabaseImplement) InsertAll(data any) error
func (*BaseDatabaseImplement) InsertAllWithCtx ¶
func (s *BaseDatabaseImplement) InsertAllWithCtx(ctx context.Context, data any) error
func (*BaseDatabaseImplement) InsertOne ¶
func (s *BaseDatabaseImplement) InsertOne(data any) error
func (*BaseDatabaseImplement) InsertOneWithCtx ¶
func (s *BaseDatabaseImplement) InsertOneWithCtx(ctx context.Context, data any) error
func (*BaseDatabaseImplement) Migrate ¶
func (s *BaseDatabaseImplement) Migrate(models ...any) error
func (*BaseDatabaseImplement) ParseDatabaseOptions ¶
func (s *BaseDatabaseImplement) ParseDatabaseOptions(db *sql.DB, opts Options)
func (*BaseDatabaseImplement) ParseLoggerOptions ¶
func (s *BaseDatabaseImplement) ParseLoggerOptions(opts Options)
func (*BaseDatabaseImplement) PickAllWithCtx ¶
func (*BaseDatabaseImplement) PickOne ¶
func (s *BaseDatabaseImplement) PickOne(receiver any, query string, args ...any) error
func (*BaseDatabaseImplement) PickOneWithCtx ¶
func (*BaseDatabaseImplement) QueryRaw ¶
func (s *BaseDatabaseImplement) QueryRaw(receiver any, sql string, args ...any) error
func (*BaseDatabaseImplement) QueryRawWithCtx ¶
func (*BaseDatabaseImplement) SetRandCommand ¶
func (s *BaseDatabaseImplement) SetRandCommand(command string)
func (*BaseDatabaseImplement) UpdateAll ¶
func (s *BaseDatabaseImplement) UpdateAll(data any, query string, args ...any) error
func (*BaseDatabaseImplement) UpdateAllWithCtx ¶
func (*BaseDatabaseImplement) UpdateOne ¶
func (s *BaseDatabaseImplement) UpdateOne(data any, query string, args ...any) error
func (*BaseDatabaseImplement) UpdateOneWithCtx ¶
type Database ¶
type Database interface { Init(options Options) error Migrate(models ...any) error Has(table string, query string, args ...any) (exist bool, err error) Count(table string, query string, args ...any) (count int64, err error) GetOne(receiver any, query string, args ...any) error GetAll(receiver any, query string, args ...any) error GetPage(receiver any, offset, limit int, query string, args ...any) error PickOne(receiver any, query string, args ...any) error PickAll(receiver any, length int, query string, args ...any) error InsertOne(data any) error InsertAll(data any) error UpdateOne(data any, query string, args ...any) error UpdateAll(data any, query string, args ...any) error DeleteOne(query string, args ...any) error DeleteAll(query string, args ...any) error ExecRaw(sql string, args ...any) error QueryRaw(receiver any, sql string, args ...any) error HasWithCtx(ctx context.Context, table string, query string, args ...any) (exist bool, err error) CountWithCtx(ctx context.Context, table string, query string, args ...any) (count int64, err error) GetOneWithCtx(ctx context.Context, receiver any, query string, args ...any) error GetAllWithCtx(ctx context.Context, receiver any, query string, args ...any) error PickOneWithCtx(ctx context.Context, receiver any, query string, args ...any) error PickAllWithCtx(ctx context.Context, receiver any, length int, query string, args ...any) error InsertOneWithCtx(ctx context.Context, data any) error InsertAllWithCtx(ctx context.Context, data any) error UpdateOneWithCtx(ctx context.Context, data any, query string, args ...any) error UpdateAllWithCtx(ctx context.Context, data any, query string, args ...any) error DeleteOneWithCtx(ctx context.Context, query string, args ...any) error DeleteAllWithCtx(ctx context.Context, query string, args ...any) error ExecRawWithCtx(ctx context.Context, sql string, args ...any) error QueryRawWithCtx(ctx context.Context, receiver any, sql string, args ...any) error }
Click to show internal directories.
Click to hide internal directories.