| | |
| | | func (s *SubPlatform) TableName() string { |
| | | return "sub_platforms" |
| | | } |
| | | |
| | | func (s *SubPlatform) FindById(id string) error { |
| | | return db.Table(s.TableName()).First(&s, "id = ?", id).Error |
| | | } |
| | | |
| | | func (s *SubPlatform) Save() error { |
| | | return db.Table(s.TableName()).Save(s).Error |
| | | } |
| | | |
| | | func (s *SubPlatform) DeleteById(id string) error { |
| | | return db.Table(s.TableName()).Where("id = ?", id).Delete(s).Error |
| | | } |
| | | |
| | | func (s *SubPlatform) FindAll() ([]SubPlatform, error) { |
| | | var list []SubPlatform |
| | | if err := db.Table(s.TableName()).Find(&list).Error; err != nil { |
| | | return nil, err |
| | | } |
| | | |
| | | return list, nil |
| | | } |