20 lines
881 B
Go
Executable File
20 lines
881 B
Go
Executable File
package gmodel
|
|
|
|
import "context"
|
|
|
|
func (l *FsProductModel3dLightModel) GetAllByIds(ctx context.Context, ids []int64) (resp []FsProductModel3dLight, err error) {
|
|
err = l.db.WithContext(ctx).Model(&FsProductModel3dLight{}).Where("`id` in (?) and `status` = ?", ids, 1).Find(&resp).Error
|
|
return resp, err
|
|
}
|
|
func (l *FsProductModel3dLightModel) GetAll(ctx context.Context) (resp []FsProductModel3dLight, err error) {
|
|
err = l.db.WithContext(ctx).Model(&FsProductModel3dLight{}).Where("`status` = ?", 1).Find(&resp).Error
|
|
return resp, err
|
|
}
|
|
|
|
func (l *FsProductModel3dLightModel) Create(ctx context.Context, data *FsProductModel3dLight) error {
|
|
return l.db.WithContext(ctx).Create(&data).Error
|
|
}
|
|
func (l *FsProductModel3dLightModel) Update(ctx context.Context, id int64, data *FsProductModel3dLight) error {
|
|
return l.db.WithContext(ctx).Where("`id` = ?", id).Updates(data).Error
|
|
}
|