• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Golang utils.VerifyErr函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Golang中github.com/safawo/fast/utils.VerifyErr函数的典型用法代码示例。如果您正苦于以下问题:Golang VerifyErr函数的具体用法?Golang VerifyErr怎么用?Golang VerifyErr使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了VerifyErr函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。

示例1: Post

func (this *AllocSafeRoleAction) Post() {
	reqMsg := &AllocSafeRoleRequest{}
	if !this.GetReqJson(reqMsg) {
		return
	}

	db := ds.DB()
	defer db.Close()

	unAllocSql := "delete from fast.roleAlloc where roleId=$1 and userId=$2"
	allocSql := "insert into fast.roleAlloc values($1,$2)"

	unAllocStmt, err := db.Prepare(unAllocSql)
	utils.VerifyErr(err)
	for _, v := range reqMsg.UnAllocs {
		unAllocStmt.Exec(v.RoleId, v.UserId)
	}
	unAllocStmt.Close()

	allocStmt, err := db.Prepare(allocSql)
	utils.VerifyErr(err)
	for _, v := range reqMsg.Allocs {
		allocStmt.Exec(v.RoleId, v.UserId)
	}
	allocStmt.Close()

	rspMsg := &AllocSafeRoleResponse{}
	rspMsg.Init(reqMsg)

	this.SendJson(rspMsg)
}
开发者ID:safawo,项目名称:fast,代码行数:31,代码来源:SafeRoleAction.go


示例2: Post

func (this *SafeOperateAuthAction) Post() {

	reqMsg := &SafeOperateAuthRequest{}
	this.GetReqJson(reqMsg)

	db := ds.DB()
	defer db.Close()

	unAuthSql := "delete from fast.operateAuth where operateId=$1 and roleId=$2"
	authSql := "insert into fast.operateAuth values($1,$2)"

	unAuthStmt, err := db.Prepare(unAuthSql)
	utils.VerifyErr(err)
	for _, v := range reqMsg.UnAuths {
		unAuthStmt.Exec(v.OperateId, v.RoleId)
	}
	unAuthStmt.Close()

	authStmt, err := db.Prepare(authSql)
	utils.VerifyErr(err)
	for _, v := range reqMsg.Auths {
		authStmt.Exec(v.OperateId, v.RoleId)
	}
	authStmt.Close()

	rspMsg := &SafeOperateAuthResponse{}
	rspMsg.Init(reqMsg)

	this.SendJson(rspMsg)

}
开发者ID:safawo,项目名称:fast,代码行数:31,代码来源:SafeOperateAction.go


示例3: Post

func (this *QuerySafeSubSysAction) Post() {
	reqMsg := &QuerySafeSubSysRequest{}
	if !this.GetReqJson(reqMsg) {
		return
	}

	db := ds.DB()
	defer db.Close()

	subSysSql := "select * from fast.subSys"

	subSysRows, err := db.Query(subSysSql)
	utils.VerifyErr(err)

	rspMsg := &QuerySafeSubSysResponse{}
	rspMsg.Init(reqMsg)

	for subSysRows.Next() {
		subSys := SubSys{}

		subSysRows.Scan(
			&subSys.Id,
			&subSys.Name)

		rspMsg.SubSyss = append(rspMsg.SubSyss, subSys)
	}

	this.SendJson(rspMsg)
}
开发者ID:safawo,项目名称:fast,代码行数:29,代码来源:SafeSubSysAction.go


示例4: init

func (this *userMgrImpl) init() {

	fmt.Println("  Init User Mgr")

	this.mapUser = map[string](*SafeUser){}

	db := ds.DB()
	defer db.Close()

	querySql := "select * from fast.safeUser"
	userRows, err := db.Query(querySql)
	utils.VerifyErr(err)

	for userRows.Next() {
		user := &SafeUser{}
		userRows.Scan(
			&user.Id,
			&user.DepartId,
			&user.Name,
			&user.Password,
			&user.EmployeeId,
			&user.NickName,
			&user.FirstName,
			&user.LastName,
			&user.Mobile,
			&user.Email,
			&user.UserRemark,
			&user.IsLock,
			&user.LockReason,
			&user.IsForever,
			&user.AccountExpired)
		this.mapUser[user.Id] = user
	}
}
开发者ID:safawo,项目名称:fast,代码行数:34,代码来源:UserMgr.go


示例5: QueryAuthsByType

func (this *safeObjectMgrImpl) QueryAuthsByType(objectType string) (objects []ObjectAuthInfo) {
	objects = []ObjectAuthInfo{}

	db := ds.DB()
	defer db.Close()

	objectType = strings.TrimSpace(objectType)

	querySql := "select distinct objectAuth.* from fast.objectAuth"
	if objectType != comm.NULL_STR {
		querySql += ",fast.safeObject where objectAuth.objectId=safeObject.id "
		querySql += " and safeObject.objectType='" + objectType + "'"
	}

	authRows, err := db.Query(querySql)
	utils.VerifyErr(err)

	for authRows.Next() {
		auth := ObjectAuthInfo{}
		authRows.Scan(&auth.ObjectId, &auth.RoleId)
		objects = append(objects, auth)
	}

	return
}
开发者ID:safawo,项目名称:fast,代码行数:25,代码来源:SafeObjectMgr.go


示例6: getDatas

func (this *SafeOperateAgent) getDatas() []SafeOperate {
	datas := []SafeOperate{}

	db := ds.DB()
	defer db.Close()

	operateSql := "select * from fast.safeOperate where 1=1"
	operateRows, err := db.Query(operateSql)
	utils.VerifyErr(err)

	for operateRows.Next() {
		operate := SafeOperate{}
		operateRows.Scan(
			&operate.Id,
			&operate.SerialId,
			&operate.OperateCode,
			&operate.Subsys,
			&operate.OperateGroup,
			&operate.OperateName,
			&operate.OperateDetail,
			&operate.OperateRemark,
			&operate.IsAuth,
			&operate.IsLog)

		operate.Departs = []string{}
		operate.Users = []string{}
		operate.Roles = []string{}

		datas = append(datas, operate)
	}

	return datas
}
开发者ID:safawo,项目名称:fast,代码行数:33,代码来源:SafeOperateAgent.go


示例7: getDatas

func (this *FastSysParaAgent) getDatas() []utils.FastSysPara {

	paras := []utils.FastSysPara{}

	db := ds.DB()
	defer db.Close()

	querySql := "select * from fast.sysParaConf"

	rows, err := db.Query(querySql)
	utils.VerifyErr(err)

	for rows.Next() {
		newPara := utils.FastSysPara{}
		err = rows.Scan(
			&newPara.Catalog,
			&newPara.ParaName,
			&newPara.ParaValue,
			&newPara.ParaType,
			&newPara.ParaRemark)
		paras = append(paras, newPara)
	}

	return paras
}
开发者ID:safawo,项目名称:fast,代码行数:25,代码来源:FastSysParaAgent.go


示例8: Post

func (this *UnLockUserAction) Post() {
	reqMsg := &UnLockUserRequest{}
	if !this.GetReqJson(reqMsg) {
		return
	}

	reqMsg.UserId = strings.TrimSpace(reqMsg.UserId)
	rspMsg := &UnLockUserResponse{}
	rspMsg.Init(reqMsg)
	if reqMsg.UserId == comm.NULL_STR {
		this.SendJson(rspMsg)
		return
	}

	db := ds.DB()
	defer db.Close()

	unLockUserSql := "update fast.safeUser set isLock=$1, lockReason=$2 where id=$3"

	unLockUserStmt, err := db.Prepare(unLockUserSql)
	utils.VerifyErr(err)
	unLockUserStmt.Exec(false, comm.NULL_STR, reqMsg.UserId)
	unLockUserStmt.Close()

	rspMsg.Init(reqMsg)
	this.SendJson(rspMsg)

}
开发者ID:safawo,项目名称:fast,代码行数:28,代码来源:SafeUserAction.go


示例9: WriteRawLog

func (this *logMgrImpl) WriteRawLog(log *OperateLog) {

	if log == nil {
		return
	}

	if log.IsEmpty() {
		return
	}

	db := ds.DB()
	defer db.Close()

	logSql := "insert into fast.operateLog values($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13)"
	logStmt, err := db.Prepare(logSql)
	utils.VerifyErr(err)
	logStmt.Exec(
		log.UserName,
		log.Subsys,
		log.OperateGroup,
		log.OperateName,
		log.OperateRet,
		log.OperateRetDetail,
		log.OperateObj,
		log.OperateContent,
		log.UserIpAddress,
		log.UserHostName,
		log.OperateTime,
		log.LogType,
		log.SerialNum)
	logStmt.Close()
}
开发者ID:safawo,项目名称:fast,代码行数:32,代码来源:LogMgr.go


示例10: Post

func (this *SelfModUserInfoAction) Post() {
	reqMsg := &SelfModUserInfoRequest{}
	if !this.GetReqJson(reqMsg) {
		return
	}

	db := ds.DB()
	defer db.Close()

	selfModSql := "update fast.safeUser set nickName=$1,firstName=$2,lastName=$3,"
	selfModSql += "mobile=$4,email=$5 where id=$6"
	selfModStmt, err := db.Prepare(selfModSql)
	utils.VerifyErr(err)
	selfModStmt.Exec(reqMsg.NickName,
		reqMsg.FirstName,
		reqMsg.LastName,
		reqMsg.Mobile,
		reqMsg.Email,
		reqMsg.Id)
	selfModStmt.Close()

	rspMsg := &SelfModUserInfoResponse{}
	rspMsg.SafeUser = reqMsg.SafeUser
	rspMsg.Init(reqMsg)

	this.SendJson(rspMsg)

}
开发者ID:safawo,项目名称:fast,代码行数:28,代码来源:SafeSelfAction.go


示例11: CreateObject

func (this *safeObjectMgrImpl) CreateObject(safeObj *SafeObject) (msgId string, ok bool) {
	msgId = comm.NULL_STR
	ok = false

	if safeObj == nil {
		return
	}

	db := ds.DB()
	defer db.Close()

	createSql := "insert into fast.safeObject values($1,$2,$3,$4,$5,$6,$7,$8)"
	createStmt, err := db.Prepare(createSql)
	utils.VerifyErr(err)

	createStmt.Exec(
		safeObj.Id,
		safeObj.SerialId,
		safeObj.ObjectType,
		safeObj.ParentPath,
		safeObj.ObjectName,
		safeObj.ObjectText,
		safeObj.ObjectImage,
		safeObj.ObjectRemark)
	createStmt.Close()

	msgId = msg.MSG_SUCCESS
	ok = true

	return
}
开发者ID:safawo,项目名称:fast,代码行数:31,代码来源:SafeObjectMgr.go


示例12: QueryObjectsByType

func (this *safeObjectMgrImpl) QueryObjectsByType(objectType string) (objects []SafeObject) {
	objects = [](SafeObject){}
	objectType = strings.TrimSpace(objectType)

	querySql := "select distinct * from fast.safeObject"
	if objectType != comm.NULL_STR {
		querySql += " where objectType='" + objectType + "'"
	}

	db := ds.DB()
	defer db.Close()

	objectRows, err := db.Query(querySql)
	utils.VerifyErr(err)

	for objectRows.Next() {
		object := SafeObject{}

		objectRows.Scan(
			&object.Id,
			&object.SerialId,
			&object.ObjectType,
			&object.ParentPath,
			&object.ObjectName,
			&object.ObjectText,
			&object.ObjectImage,
			&object.ObjectRemark)

		objects = append(objects, object)
	}

	return
}
开发者ID:safawo,项目名称:fast,代码行数:33,代码来源:SafeObjectMgr.go


示例13: init

func (this *operateMgrImpl) init() {
	fmt.Println("  Init Operate Mgr")

	this.mapOperate = map[string](*SafeOperate){}

	db := ds.DB()
	defer db.Close()

	querySql := "select * from fast.safeOperate"
	operateRows, err := db.Query(querySql)
	utils.VerifyErr(err)

	for operateRows.Next() {
		operate := &SafeOperate{}
		operateRows.Scan(
			&operate.Id,
			&operate.SerialId,
			&operate.OperateCode,
			&operate.Subsys,
			&operate.OperateGroup,
			&operate.OperateName,
			&operate.OperateDetail,
			&operate.OperateRemark,
			&operate.IsAuth,
			&operate.IsLog)
		this.mapOperate[operate.OperateCode] = operate
	}

}
开发者ID:safawo,项目名称:fast,代码行数:29,代码来源:OperateMgr.go


示例14: buildDeveloper

func buildDeveloper() {
	licenseInfo := &FastLicenseInfo{}
	licenseInfo.Reset()

	licenseInfo.Distributor = "liuyong"
	licenseInfo.DistributeId = "liuyong1024"

	licenseInfo.LicenseId = "develop"
	licenseInfo.LicenseType = LICENSE_TYPE_DEVELOP

	licenseInfo.CustomerId = "FFFFFFFFFFFF"
	licenseInfo.CustomerName = "developer"

	licenseInfo.BindNetCard = comm.NULL_STR
	licenseInfo.BindDisk = comm.NULL_STR
	licenseInfo.BindCPU = comm.NULL_STR

	licenseInfo.ExpiryDate = "2015-09-15 23:59:59"
	licenseInfo.Remark = comm.NULL_STR

	licenseInfo.AllowInt["clientOnlineLimit"] = 5
	licenseInfo.AllowInt["lockLimit"] = 10000
	licenseInfo.AllowInt["userGroupLimit"] = 256
	licenseInfo.AllowInt["timeTableLimit"] = 8
	licenseInfo.AllowInt["commonDoorLimit"] = 53

	givePads := []string{}
	givePads = append(givePads, "superpad")
	givePads = append(givePads, "353723050291384")
	givePads = append(givePads, "869274012114451")
	givePads = append(givePads, "861519010479951")
	givePads = append(givePads, "BX9034PWKC")
	givePads = append(givePads, "2F32000200000001")
	givePads = append(givePads, "021YHB2133052646")

	licenseInfo.AllowStrs["givePads"] = givePads

	byteLicense, err := json.MarshalIndent(licenseInfo, "", "  ")
	utils.VerifyErr(err)

	licenseContent := utils.EnCodeBase64(string(byteLicense))
	licenseContent = utils.EnCodeBase64(licenseContent)
	licenseContent = utils.EnCodeBase64(licenseContent)

	fmt.Println(licenseContent)

	licenseFile := "developlicense.lic"
	fout, err := os.Create(licenseFile)
	defer fout.Close()
	if err != nil {
		fmt.Println(licenseFile, err)
		return
	}

	fout.Write([]byte(licenseContent))

}
开发者ID:safawo,项目名称:fast,代码行数:57,代码来源:LicenseBuilder.go


示例15: Post

func (this *QueryMyAccessObjectAction) Post() {
	reqMsg := &QueryMyAccessObjectRequest{}
	if !this.GetReqJson(reqMsg) {
		return
	}

	reqMsg.ObjectType = strings.TrimSpace(reqMsg.ObjectType)

	rspMsg := &QueryMyAccessObjectResponse{}
	rspMsg.Init(reqMsg)

	sessionId := reqMsg.GetReqSessionId()
	session, ok := SessionMgr().GetSession(sessionId)
	if !ok {
		rspMsg.SetRspRetId(msg.MSG_FAIL)
		this.SendJson(rspMsg)
		return
	}

	userId := session.GetUserId()

	db := ds.DB()
	defer db.Close()

	querySql := comm.NULL_STR
	if !session.IsAdmin() {
		querySql += "select distinct obj.id,obj.objectName from fast.safeObject obj, fast.objectAuth auth where "
		querySql += "obj.id = auth.objectId "
		if reqMsg.ObjectType != comm.NULL_STR {
			querySql += "and obj.objectType='" + reqMsg.ObjectType + "' "
		}

		querySql += "and (auth.roleId='" + userId + "' or auth.roleId in(select distinct alloc.roleId "
		querySql += "from fast.roleAlloc alloc where alloc.userId='" + userId + "'))"
	} else {
		querySql += "select distinct obj.id,obj.objectName from fast.safeObject obj where 1=1 "
		if reqMsg.ObjectType != comm.NULL_STR {
			querySql += "and obj.objectType='" + reqMsg.ObjectType + "' "
		}
	}

	fmt.Println("query access object sql:", querySql)

	objRows, err := db.Query(querySql)
	utils.VerifyErr(err)

	objectId := comm.NULL_STR
	objectName := comm.NULL_STR
	for objRows.Next() {
		objRows.Scan(&objectId, &objectName)
		rspMsg.ObjectIds = append(rspMsg.ObjectIds, objectId)
		rspMsg.ObjectNames = append(rspMsg.ObjectNames, objectName)
	}

	this.SendJson(rspMsg)
}
开发者ID:safawo,项目名称:fast,代码行数:56,代码来源:SafeAccessAction.go


示例16: GetReqJson

func (this *JsonAction) GetReqJson(reqMsg interface{}) (ok bool) {
	ok = true

	reqByte, err := ioutil.ReadAll(this.Ctx.Request.Body)
	utils.VerifyErr(err)

	fmt.Println("Fast Action Request Msg, client:", this.Ctx.Request.RemoteAddr,
		",server:", this.Ctx.Request.Host)
	fmt.Println(string(reqByte))

	err = json.Unmarshal(reqByte, reqMsg)
	utils.VerifyErr(err)

	reqInterfaceTry, isReq := reqMsg.(FastRequestInterface)
	if !isReq {
		return
	}
	this.reqInterface = reqInterfaceTry

	if this.GetReqInfo().GetReqSessionId() == "init" {
		return
	}

	if getSessionValidater() == nil {
		return
	}

	if getSessionValidater().Validate(this.GetReqInfo()) {
		return
	}

	ok = false

	vaidateRsp := &FastResponseWrap{}
	if this.GetReqInfo() != nil {
		vaidateRsp.Init(this.GetReqInfo())
	}

	vaidateRsp.SetRsp(msg.MSG_SESSION_INVALID)
	this.SendJson(vaidateRsp)

	return
}
开发者ID:safawo,项目名称:fast,代码行数:43,代码来源:JsonAction.go


示例17: delUser

func (this *userMgrImpl) delUser(userId string) {
	userId = strings.TrimSpace(userId)
	delete(this.mapUser, userId)

	db := ds.DB()
	defer db.Close()

	delUserSql := "delete from fast.safeUser where id=$1"
	delUserStmt, err := db.Prepare(delUserSql)
	utils.VerifyErr(err)
	delUserStmt.Exec(userId)
	delUserStmt.Close()

	delRoleMapSql := "delete from fast.safeRole where id=$1 and isUser=true"
	delRoleMapStmt, err := db.Prepare(delRoleMapSql)
	utils.VerifyErr(err)
	delRoleMapStmt.Exec(userId)
	delRoleMapStmt.Close()

	delRoleAllocSql := "delete from fast.roleAlloc where userId=$1"
	delRoleAllocStmt, err := db.Prepare(delRoleAllocSql)
	utils.VerifyErr(err)
	delRoleAllocStmt.Exec(userId)
	delRoleAllocStmt.Close()

	delOperateAuthSql := "delete from fast.operateAuth where roleId=$1"
	delOperateAuthStmt, err := db.Prepare(delOperateAuthSql)
	utils.VerifyErr(err)
	delOperateAuthStmt.Exec(userId)
	delOperateAuthStmt.Close()

	delObjAuthSql := "delete from fast.roleAlloc where roleId=$1"
	delObjAuthStmt, err := db.Prepare(delObjAuthSql)
	utils.VerifyErr(err)
	delObjAuthStmt.Exec(userId)
	delObjAuthStmt.Close()

	return
}
开发者ID:safawo,项目名称:fast,代码行数:39,代码来源:UserMgr.go


示例18: DelObjectByName

func (this *safeObjectMgrImpl) DelObjectByName(objectName string) {
	objectName = strings.TrimSpace(objectName)

	db := ds.DB()
	defer db.Close()

	delSql := "delete from fast.safeObject where objectName=$1"

	delStmt, err := db.Prepare(delSql)
	utils.VerifyErr(err)
	delStmt.Exec(objectName)
	delStmt.Close()

	return
}
开发者ID:safawo,项目名称:fast,代码行数:15,代码来源:SafeObjectMgr.go


示例19: UnAuth

func (this *safeObjectMgrImpl) UnAuth(unAuths []ObjectAuthInfo) {

	db := ds.DB()
	defer db.Close()

	unAuthSql := "delete from fast.objectAuth where objectId=$1 and roleId=$2"

	unAuthStmt, err := db.Prepare(unAuthSql)
	utils.VerifyErr(err)
	for _, v := range unAuths {
		unAuthStmt.Exec(v.ObjectId, v.RoleId)
	}
	unAuthStmt.Close()

	return
}
开发者ID:safawo,项目名称:fast,代码行数:16,代码来源:SafeObjectMgr.go


示例20: Auth

func (this *safeObjectMgrImpl) Auth(auths []ObjectAuthInfo) {

	db := ds.DB()
	defer db.Close()

	authSql := "insert into fast.objectAuth values($1,$2)"

	authStmt, err := db.Prepare(authSql)
	utils.VerifyErr(err)
	for _, v := range auths {
		authStmt.Exec(v.ObjectId, v.RoleId)
	}
	authStmt.Close()

	return
}
开发者ID:safawo,项目名称:fast,代码行数:16,代码来源:SafeObjectMgr.go



注:本文中的github.com/safawo/fast/utils.VerifyErr函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Golang action.ActionFunc函数代码示例发布时间:2022-05-28
下一篇:
Golang ds.DB函数代码示例发布时间:2022-05-28
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap