Initial commit.
This commit is contained in:
395
query/nachrichts.gen.go
Normal file
395
query/nachrichts.gen.go
Normal file
@ -0,0 +1,395 @@
|
||||
// Code generated by gorm.io/gen. DO NOT EDIT.
|
||||
// Code generated by gorm.io/gen. DO NOT EDIT.
|
||||
// Code generated by gorm.io/gen. DO NOT EDIT.
|
||||
|
||||
package query
|
||||
|
||||
import (
|
||||
"context"
|
||||
"database/sql"
|
||||
|
||||
"gorm.io/gorm"
|
||||
"gorm.io/gorm/clause"
|
||||
"gorm.io/gorm/schema"
|
||||
|
||||
"gorm.io/gen"
|
||||
"gorm.io/gen/field"
|
||||
|
||||
"gorm.io/plugin/dbresolver"
|
||||
|
||||
"git.kocoder.xyz/kocoded/vt/model"
|
||||
)
|
||||
|
||||
func newNachricht(db *gorm.DB, opts ...gen.DOOption) nachricht {
|
||||
_nachricht := nachricht{}
|
||||
|
||||
_nachricht.nachrichtDo.UseDB(db, opts...)
|
||||
_nachricht.nachrichtDo.UseModel(&model.Nachricht{})
|
||||
|
||||
tableName := _nachricht.nachrichtDo.TableName()
|
||||
_nachricht.ALL = field.NewAsterisk(tableName)
|
||||
_nachricht.ID = field.NewUint(tableName, "id")
|
||||
_nachricht.CreatedAt = field.NewTime(tableName, "created_at")
|
||||
_nachricht.UpdatedAt = field.NewTime(tableName, "updated_at")
|
||||
_nachricht.DeletedAt = field.NewField(tableName, "deleted_at")
|
||||
|
||||
_nachricht.fillFieldMap()
|
||||
|
||||
return _nachricht
|
||||
}
|
||||
|
||||
type nachricht struct {
|
||||
nachrichtDo
|
||||
|
||||
ALL field.Asterisk
|
||||
ID field.Uint
|
||||
CreatedAt field.Time
|
||||
UpdatedAt field.Time
|
||||
DeletedAt field.Field
|
||||
|
||||
fieldMap map[string]field.Expr
|
||||
}
|
||||
|
||||
func (n nachricht) Table(newTableName string) *nachricht {
|
||||
n.nachrichtDo.UseTable(newTableName)
|
||||
return n.updateTableName(newTableName)
|
||||
}
|
||||
|
||||
func (n nachricht) As(alias string) *nachricht {
|
||||
n.nachrichtDo.DO = *(n.nachrichtDo.As(alias).(*gen.DO))
|
||||
return n.updateTableName(alias)
|
||||
}
|
||||
|
||||
func (n *nachricht) updateTableName(table string) *nachricht {
|
||||
n.ALL = field.NewAsterisk(table)
|
||||
n.ID = field.NewUint(table, "id")
|
||||
n.CreatedAt = field.NewTime(table, "created_at")
|
||||
n.UpdatedAt = field.NewTime(table, "updated_at")
|
||||
n.DeletedAt = field.NewField(table, "deleted_at")
|
||||
|
||||
n.fillFieldMap()
|
||||
|
||||
return n
|
||||
}
|
||||
|
||||
func (n *nachricht) GetFieldByName(fieldName string) (field.OrderExpr, bool) {
|
||||
_f, ok := n.fieldMap[fieldName]
|
||||
if !ok || _f == nil {
|
||||
return nil, false
|
||||
}
|
||||
_oe, ok := _f.(field.OrderExpr)
|
||||
return _oe, ok
|
||||
}
|
||||
|
||||
func (n *nachricht) fillFieldMap() {
|
||||
n.fieldMap = make(map[string]field.Expr, 4)
|
||||
n.fieldMap["id"] = n.ID
|
||||
n.fieldMap["created_at"] = n.CreatedAt
|
||||
n.fieldMap["updated_at"] = n.UpdatedAt
|
||||
n.fieldMap["deleted_at"] = n.DeletedAt
|
||||
}
|
||||
|
||||
func (n nachricht) clone(db *gorm.DB) nachricht {
|
||||
n.nachrichtDo.ReplaceConnPool(db.Statement.ConnPool)
|
||||
return n
|
||||
}
|
||||
|
||||
func (n nachricht) replaceDB(db *gorm.DB) nachricht {
|
||||
n.nachrichtDo.ReplaceDB(db)
|
||||
return n
|
||||
}
|
||||
|
||||
type nachrichtDo struct{ gen.DO }
|
||||
|
||||
type INachrichtDo interface {
|
||||
gen.SubQuery
|
||||
Debug() INachrichtDo
|
||||
WithContext(ctx context.Context) INachrichtDo
|
||||
WithResult(fc func(tx gen.Dao)) gen.ResultInfo
|
||||
ReplaceDB(db *gorm.DB)
|
||||
ReadDB() INachrichtDo
|
||||
WriteDB() INachrichtDo
|
||||
As(alias string) gen.Dao
|
||||
Session(config *gorm.Session) INachrichtDo
|
||||
Columns(cols ...field.Expr) gen.Columns
|
||||
Clauses(conds ...clause.Expression) INachrichtDo
|
||||
Not(conds ...gen.Condition) INachrichtDo
|
||||
Or(conds ...gen.Condition) INachrichtDo
|
||||
Select(conds ...field.Expr) INachrichtDo
|
||||
Where(conds ...gen.Condition) INachrichtDo
|
||||
Order(conds ...field.Expr) INachrichtDo
|
||||
Distinct(cols ...field.Expr) INachrichtDo
|
||||
Omit(cols ...field.Expr) INachrichtDo
|
||||
Join(table schema.Tabler, on ...field.Expr) INachrichtDo
|
||||
LeftJoin(table schema.Tabler, on ...field.Expr) INachrichtDo
|
||||
RightJoin(table schema.Tabler, on ...field.Expr) INachrichtDo
|
||||
Group(cols ...field.Expr) INachrichtDo
|
||||
Having(conds ...gen.Condition) INachrichtDo
|
||||
Limit(limit int) INachrichtDo
|
||||
Offset(offset int) INachrichtDo
|
||||
Count() (count int64, err error)
|
||||
Scopes(funcs ...func(gen.Dao) gen.Dao) INachrichtDo
|
||||
Unscoped() INachrichtDo
|
||||
Create(values ...*model.Nachricht) error
|
||||
CreateInBatches(values []*model.Nachricht, batchSize int) error
|
||||
Save(values ...*model.Nachricht) error
|
||||
First() (*model.Nachricht, error)
|
||||
Take() (*model.Nachricht, error)
|
||||
Last() (*model.Nachricht, error)
|
||||
Find() ([]*model.Nachricht, error)
|
||||
FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.Nachricht, err error)
|
||||
FindInBatches(result *[]*model.Nachricht, batchSize int, fc func(tx gen.Dao, batch int) error) error
|
||||
Pluck(column field.Expr, dest interface{}) error
|
||||
Delete(...*model.Nachricht) (info gen.ResultInfo, err error)
|
||||
Update(column field.Expr, value interface{}) (info gen.ResultInfo, err error)
|
||||
UpdateSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error)
|
||||
Updates(value interface{}) (info gen.ResultInfo, err error)
|
||||
UpdateColumn(column field.Expr, value interface{}) (info gen.ResultInfo, err error)
|
||||
UpdateColumnSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error)
|
||||
UpdateColumns(value interface{}) (info gen.ResultInfo, err error)
|
||||
UpdateFrom(q gen.SubQuery) gen.Dao
|
||||
Attrs(attrs ...field.AssignExpr) INachrichtDo
|
||||
Assign(attrs ...field.AssignExpr) INachrichtDo
|
||||
Joins(fields ...field.RelationField) INachrichtDo
|
||||
Preload(fields ...field.RelationField) INachrichtDo
|
||||
FirstOrInit() (*model.Nachricht, error)
|
||||
FirstOrCreate() (*model.Nachricht, error)
|
||||
FindByPage(offset int, limit int) (result []*model.Nachricht, count int64, err error)
|
||||
ScanByPage(result interface{}, offset int, limit int) (count int64, err error)
|
||||
Rows() (*sql.Rows, error)
|
||||
Row() *sql.Row
|
||||
Scan(result interface{}) (err error)
|
||||
Returning(value interface{}, columns ...string) INachrichtDo
|
||||
UnderlyingDB() *gorm.DB
|
||||
schema.Tabler
|
||||
}
|
||||
|
||||
func (n nachrichtDo) Debug() INachrichtDo {
|
||||
return n.withDO(n.DO.Debug())
|
||||
}
|
||||
|
||||
func (n nachrichtDo) WithContext(ctx context.Context) INachrichtDo {
|
||||
return n.withDO(n.DO.WithContext(ctx))
|
||||
}
|
||||
|
||||
func (n nachrichtDo) ReadDB() INachrichtDo {
|
||||
return n.Clauses(dbresolver.Read)
|
||||
}
|
||||
|
||||
func (n nachrichtDo) WriteDB() INachrichtDo {
|
||||
return n.Clauses(dbresolver.Write)
|
||||
}
|
||||
|
||||
func (n nachrichtDo) Session(config *gorm.Session) INachrichtDo {
|
||||
return n.withDO(n.DO.Session(config))
|
||||
}
|
||||
|
||||
func (n nachrichtDo) Clauses(conds ...clause.Expression) INachrichtDo {
|
||||
return n.withDO(n.DO.Clauses(conds...))
|
||||
}
|
||||
|
||||
func (n nachrichtDo) Returning(value interface{}, columns ...string) INachrichtDo {
|
||||
return n.withDO(n.DO.Returning(value, columns...))
|
||||
}
|
||||
|
||||
func (n nachrichtDo) Not(conds ...gen.Condition) INachrichtDo {
|
||||
return n.withDO(n.DO.Not(conds...))
|
||||
}
|
||||
|
||||
func (n nachrichtDo) Or(conds ...gen.Condition) INachrichtDo {
|
||||
return n.withDO(n.DO.Or(conds...))
|
||||
}
|
||||
|
||||
func (n nachrichtDo) Select(conds ...field.Expr) INachrichtDo {
|
||||
return n.withDO(n.DO.Select(conds...))
|
||||
}
|
||||
|
||||
func (n nachrichtDo) Where(conds ...gen.Condition) INachrichtDo {
|
||||
return n.withDO(n.DO.Where(conds...))
|
||||
}
|
||||
|
||||
func (n nachrichtDo) Order(conds ...field.Expr) INachrichtDo {
|
||||
return n.withDO(n.DO.Order(conds...))
|
||||
}
|
||||
|
||||
func (n nachrichtDo) Distinct(cols ...field.Expr) INachrichtDo {
|
||||
return n.withDO(n.DO.Distinct(cols...))
|
||||
}
|
||||
|
||||
func (n nachrichtDo) Omit(cols ...field.Expr) INachrichtDo {
|
||||
return n.withDO(n.DO.Omit(cols...))
|
||||
}
|
||||
|
||||
func (n nachrichtDo) Join(table schema.Tabler, on ...field.Expr) INachrichtDo {
|
||||
return n.withDO(n.DO.Join(table, on...))
|
||||
}
|
||||
|
||||
func (n nachrichtDo) LeftJoin(table schema.Tabler, on ...field.Expr) INachrichtDo {
|
||||
return n.withDO(n.DO.LeftJoin(table, on...))
|
||||
}
|
||||
|
||||
func (n nachrichtDo) RightJoin(table schema.Tabler, on ...field.Expr) INachrichtDo {
|
||||
return n.withDO(n.DO.RightJoin(table, on...))
|
||||
}
|
||||
|
||||
func (n nachrichtDo) Group(cols ...field.Expr) INachrichtDo {
|
||||
return n.withDO(n.DO.Group(cols...))
|
||||
}
|
||||
|
||||
func (n nachrichtDo) Having(conds ...gen.Condition) INachrichtDo {
|
||||
return n.withDO(n.DO.Having(conds...))
|
||||
}
|
||||
|
||||
func (n nachrichtDo) Limit(limit int) INachrichtDo {
|
||||
return n.withDO(n.DO.Limit(limit))
|
||||
}
|
||||
|
||||
func (n nachrichtDo) Offset(offset int) INachrichtDo {
|
||||
return n.withDO(n.DO.Offset(offset))
|
||||
}
|
||||
|
||||
func (n nachrichtDo) Scopes(funcs ...func(gen.Dao) gen.Dao) INachrichtDo {
|
||||
return n.withDO(n.DO.Scopes(funcs...))
|
||||
}
|
||||
|
||||
func (n nachrichtDo) Unscoped() INachrichtDo {
|
||||
return n.withDO(n.DO.Unscoped())
|
||||
}
|
||||
|
||||
func (n nachrichtDo) Create(values ...*model.Nachricht) error {
|
||||
if len(values) == 0 {
|
||||
return nil
|
||||
}
|
||||
return n.DO.Create(values)
|
||||
}
|
||||
|
||||
func (n nachrichtDo) CreateInBatches(values []*model.Nachricht, batchSize int) error {
|
||||
return n.DO.CreateInBatches(values, batchSize)
|
||||
}
|
||||
|
||||
// Save : !!! underlying implementation is different with GORM
|
||||
// The method is equivalent to executing the statement: db.Clauses(clause.OnConflict{UpdateAll: true}).Create(values)
|
||||
func (n nachrichtDo) Save(values ...*model.Nachricht) error {
|
||||
if len(values) == 0 {
|
||||
return nil
|
||||
}
|
||||
return n.DO.Save(values)
|
||||
}
|
||||
|
||||
func (n nachrichtDo) First() (*model.Nachricht, error) {
|
||||
if result, err := n.DO.First(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*model.Nachricht), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (n nachrichtDo) Take() (*model.Nachricht, error) {
|
||||
if result, err := n.DO.Take(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*model.Nachricht), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (n nachrichtDo) Last() (*model.Nachricht, error) {
|
||||
if result, err := n.DO.Last(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*model.Nachricht), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (n nachrichtDo) Find() ([]*model.Nachricht, error) {
|
||||
result, err := n.DO.Find()
|
||||
return result.([]*model.Nachricht), err
|
||||
}
|
||||
|
||||
func (n nachrichtDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.Nachricht, err error) {
|
||||
buf := make([]*model.Nachricht, 0, batchSize)
|
||||
err = n.DO.FindInBatches(&buf, batchSize, func(tx gen.Dao, batch int) error {
|
||||
defer func() { results = append(results, buf...) }()
|
||||
return fc(tx, batch)
|
||||
})
|
||||
return results, err
|
||||
}
|
||||
|
||||
func (n nachrichtDo) FindInBatches(result *[]*model.Nachricht, batchSize int, fc func(tx gen.Dao, batch int) error) error {
|
||||
return n.DO.FindInBatches(result, batchSize, fc)
|
||||
}
|
||||
|
||||
func (n nachrichtDo) Attrs(attrs ...field.AssignExpr) INachrichtDo {
|
||||
return n.withDO(n.DO.Attrs(attrs...))
|
||||
}
|
||||
|
||||
func (n nachrichtDo) Assign(attrs ...field.AssignExpr) INachrichtDo {
|
||||
return n.withDO(n.DO.Assign(attrs...))
|
||||
}
|
||||
|
||||
func (n nachrichtDo) Joins(fields ...field.RelationField) INachrichtDo {
|
||||
for _, _f := range fields {
|
||||
n = *n.withDO(n.DO.Joins(_f))
|
||||
}
|
||||
return &n
|
||||
}
|
||||
|
||||
func (n nachrichtDo) Preload(fields ...field.RelationField) INachrichtDo {
|
||||
for _, _f := range fields {
|
||||
n = *n.withDO(n.DO.Preload(_f))
|
||||
}
|
||||
return &n
|
||||
}
|
||||
|
||||
func (n nachrichtDo) FirstOrInit() (*model.Nachricht, error) {
|
||||
if result, err := n.DO.FirstOrInit(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*model.Nachricht), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (n nachrichtDo) FirstOrCreate() (*model.Nachricht, error) {
|
||||
if result, err := n.DO.FirstOrCreate(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*model.Nachricht), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (n nachrichtDo) FindByPage(offset int, limit int) (result []*model.Nachricht, count int64, err error) {
|
||||
result, err = n.Offset(offset).Limit(limit).Find()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if size := len(result); 0 < limit && 0 < size && size < limit {
|
||||
count = int64(size + offset)
|
||||
return
|
||||
}
|
||||
|
||||
count, err = n.Offset(-1).Limit(-1).Count()
|
||||
return
|
||||
}
|
||||
|
||||
func (n nachrichtDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) {
|
||||
count, err = n.Count()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
err = n.Offset(offset).Limit(limit).Scan(result)
|
||||
return
|
||||
}
|
||||
|
||||
func (n nachrichtDo) Scan(result interface{}) (err error) {
|
||||
return n.DO.Scan(result)
|
||||
}
|
||||
|
||||
func (n nachrichtDo) Delete(models ...*model.Nachricht) (result gen.ResultInfo, err error) {
|
||||
return n.DO.Delete(models)
|
||||
}
|
||||
|
||||
func (n *nachrichtDo) withDO(do gen.Dao) *nachrichtDo {
|
||||
n.DO = *do.(*gen.DO)
|
||||
return n
|
||||
}
|
Reference in New Issue
Block a user