1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- package model
- import (
- "git.getensh.com/common/gopkgsv2/database"
- "gorm.io/gorm"
- )
- type Dws8Model interface {
- Get(db *gorm.DB) (*AdmDws8, error)
- List(db *gorm.DB) ([]AdmDws8, error)
- Count(db *gorm.DB) (int64, error)
- Update(db *gorm.DB, values interface{}) error
- }
- type AdmDws8 struct {
- ID int64 `gorm:"column:id" json:"id" form:"id"`
- Vin string `gorm:"column:vin" json:"vin" form:"vin"`
- InsuranceDate string `gorm:"column:insurance_date" json:"insurance_date" form:"insurance_date"`
- CreatedAt int64 `gorm:"column:created_at" json:"created_at" form:"created_at"`
- UpdatedAt int64 `gorm:"column:updated_at" json:"updated_at" form:"updated_at"`
- }
- type defaultDws8 struct {
- tableName string
- fields string
- }
- func NewDws8Model() Dws8Model {
- return &defaultDws8{
- tableName: "t_adm_dws8",
- fields: "id, vin, insurance_date, created_at, updated_at",
- }
- }
- func (d *defaultDws8) Get(db *gorm.DB) (*AdmDws8, error) {
- var res AdmDws8
- err := database.Get(db, &res, database.Option{
- TableName: d.tableName,
- Fields: d.fields,
- })
- return &res, err
- }
- func (d *defaultDws8) List(db *gorm.DB) ([]AdmDws8, error) {
- var res []AdmDws8
- err := database.List(db, &res, database.Option{
- TableName: d.tableName,
- Fields: d.fields,
- })
- return res, err
- }
- func (d *defaultDws8) Count(db *gorm.DB) (int64, error) {
- return database.Count(db, database.Option{
- TableName: d.tableName,
- })
- }
- func (d *defaultDws8) Update(db *gorm.DB, values interface{}) error {
- return database.Update(db, values, database.Option{
- TableName: d.tableName,
- })
- }
|