作者 yangfu

Merge branch 'test'

... ... @@ -14,7 +14,9 @@ func AsyncEvent(e *domain.EventTable) {
log.Logger.Error(fmt.Sprintf("%v", p))
}
}()
time.Sleep(time.Second * 1)
e.FireEvent()
}()
log.Logger.Info("开始事件..." + e.Type.ToString())
time.Sleep(time.Millisecond * 400)
log.Logger.Info("结束事件..." + e.Type.ToString())
}
... ...
... ... @@ -53,6 +53,7 @@ func (ptr *QuerySetService) Create(ctx *domain.Context, qs *domain.QuerySet) (*d
querySetRepository, err := repository.NewQuerySetRepository(ptr.transactionContext)
// check parent
options := map[string]interface{}{
"context": ctx,
"type": qs.Type,
"flag": qs.Flag,
"name": qs.Name,
... ...
package repository
import (
"github.com/linmadan/egglib-go/persistent/pg/sqlbuilder"
"gitlab.fjmaimaimai.com/allied-creation/character-library-metadata-bastion/pkg/domain"
"gitlab.fjmaimaimai.com/allied-creation/character-library-metadata-bastion/pkg/infrastructure/utils"
)
func WhereContext(query *sqlbuilder.Query, queryOptions map[string]interface{}) *sqlbuilder.Query{
func WhereContext(query *sqlbuilder.Query, queryOptions map[string]interface{}) *sqlbuilder.Query {
if _, ok := queryOptions["context"]; !ok {
return query
}
... ... @@ -16,15 +15,14 @@ func WhereContext(query *sqlbuilder.Query, queryOptions map[string]interface{})
return query
}
func SetOffsetAndLimit(query *sqlbuilder.Query, queryOptions map[string]interface{},defaultLimit int) {
pageNumber,pnOk:=queryOptions["pageNumber"]
pageSize,psOk :=queryOptions["pageSize"]
if pnOk && psOk{
iPageNumber:=utils.NumberString(utils.AssertString(pageNumber)).MustInt()
iPageSize:=utils.NumberString(utils.AssertString(pageSize)).MustInt()
func SetOffsetAndLimit(query *sqlbuilder.Query, queryOptions map[string]interface{}, defaultLimit int) {
pageNumber, pnOk := queryOptions["pageNumber"]
pageSize, psOk := queryOptions["pageSize"]
if pnOk && psOk {
iPageNumber := utils.NumberString(utils.AssertString(pageNumber)).MustInt()
iPageSize := utils.NumberString(utils.AssertString(pageSize)).MustInt()
queryOptions["limit"] = iPageSize
queryOptions["offset"] = (iPageSize*(iPageNumber-1))
queryOptions["offset"] = (iPageSize * (iPageNumber - 1))
}
query.SetOffsetAndLimit(defaultLimit)
}
... ...
... ... @@ -11,11 +11,12 @@ func tableDataChangeHandler(e event.Event) error {
et := &domain.EventTable{}
et.ResolveEvent(e)
svr := service.NewTableEventService(nil)
_, err := svr.Handler(nil, &command.TableEventCommand{
// 此处优先处理冲突状态更新(后续删除更新缓存比较慢)
svr.HandlerTableAffectedMarkToConflictStatus(et.Context, &command.TableEventCommand{
EventTable: et,
})
svr.HandlerTableAffectedMarkToConflictStatus(et.Context, &command.TableEventCommand{
_, err := svr.Handler(nil, &command.TableEventCommand{
EventTable: et,
})
return err
... ...