func (c *HasSubDao) QueryWithLock(conn orm.DB, condition string, params ...interface{}) (ms []*model.HasSub, err error) {
	if len(condition) < 1 {
		err = conn.Model(&ms).For("UPDATE").Select()
	} else {
		err = conn.Model(&ms).Where(condition, params...).For("UPDATE").Select()
	}
	if err != nil {  
		ms = nil
	}
	return
}
if find nothing, return pg.ErrNoRows
package dao
import (
	"time"
	"github.com/go-pg/pg/v10"
	"github.com/go-pg/pg/v10/orm"
	"github.com/scryinfo/dot/dot"
	"github.com/scryinfo/dot/dots/db/pgs"
	"github.com/scryinfo/dot/sample/db/pgs/model"
	"github.com/scryinfo/scryg/sutils/uuid"
)
const HasSubDaoTypeID = "3b1ac788-78e2-4172-9fa2-709b021d7e12"
type HasSubDao struct {
	*pgs.DaoBase `dot:""`
}
func HasSubDaoTypeLives() []*dot.TypeLives {
	tl := &dot.TypeLives{
		Meta: dot.Metadata{
			Name:   "HasSubDao",
			TypeID: HasSubDaoTypeID,
			NewDoter: func(conf []byte) (dot.Dot, error) {
				return &HasSubDao{}, nil
			},
		},
		Lives: []dot.Live{
			{
				LiveID: HasSubDaoTypeID,
				RelyLives: map[string]dot.LiveID{
					"DaoBase": pgs.DaoBaseTypeID,
				},
			},
		},
	}
	lives := pgs.DaoBaseTypeLives()
	lives = append(lives, tl)
	return lives
}
func (c *HasSubDao) GetByIDWithLock(conn orm.DB, id string) (m *model.HasSub, err error) {
	m = &model.HasSub{}
	m.ID = id
	err = conn.Model(m).WherePK().For("UPDATE").Select()
	if err != nil {
		m = nil
	}
	return
}
func (c *HasSubDao) GetByID(conn orm.DB, id string) (m *model.HasSub, err error) {
	m = &model.HasSub{}
	m.ID = id
	err = conn.Model(m).WherePK().Select()
	if err != nil {
		m = nil
	}
	return
}
func (c *HasSubDao) GetLockByID(conn orm.DB, ids ...string) (ms []*model.HasSub, err error) {
	for i, _ := range ids {
		m := &model.HasSub{}
		m.ID = ids[i]
		ms = append(ms, m)
	}
	err = conn.Model(&ms).WherePK().Column(model.HasSub_OptimisticLockVersion, model.HasSub_ID).For("UPDATE").Select()
	if err != nil {
		ms = nil
	}
	return
}
func (c *HasSubDao) GetLockByModelID(conn orm.DB, ms ...*model.HasSub) error {
	return conn.Model(&ms).WherePK().Column(model.HasSub_OptimisticLockVersion, model.HasSub_ID).For("UPDATE").Select()
}