當前位置: 首頁>>代碼示例>>Golang>>正文


Golang utils.VerifyErr函數代碼示例

本文整理匯總了Golang中github.com/safawo/fast/utils.VerifyErr函數的典型用法代碼示例。如果您正苦於以下問題:Golang VerifyErr函數的具體用法?Golang VerifyErr怎麽用?Golang VerifyErr使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了VerifyErr函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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


注:本文中的github.com/safawo/fast/utils.VerifyErr函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。