base.go 281 B

123456789101112131415161718192021
  1. package models
  2. import "ppgo/common"
  3. type BaseOrm struct {
  4. }
  5. type IOrm interface {
  6. Find(orm IOrm) BaseOrm
  7. }
  8. func (o BaseOrm) tableName() string {
  9. return "app"
  10. }
  11. func (o BaseOrm) Find(a any) any {
  12. if common.GetDb().Find(&a, 1).RowsAffected == 0 {
  13. return nil
  14. }
  15. return a
  16. }