本文整理匯總了Golang中github.com/cgrates/cgrates/utils.RSRField.Id方法的典型用法代碼示例。如果您正苦於以下問題:Golang RSRField.Id方法的具體用法?Golang RSRField.Id怎麽用?Golang RSRField.Id使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/cgrates/cgrates/utils.RSRField
的用法示例。
在下文中一共展示了RSRField.Id方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: ForkCdr
// Used in mediation, primaryMandatory marks whether missing field out of request represents error or can be ignored
func (cdr *CDR) ForkCdr(runId string, RequestTypeFld, directionFld, tenantFld, categFld, accountFld, subjectFld, destFld, setupTimeFld, PDDFld,
answerTimeFld, durationFld, supplierFld, disconnectCauseFld, ratedFld, costFld *utils.RSRField,
extraFlds []*utils.RSRField, primaryMandatory bool, timezone string) (*CDR, error) {
if RequestTypeFld == nil {
RequestTypeFld, _ = utils.NewRSRField(utils.META_DEFAULT)
}
if RequestTypeFld.Id == utils.META_DEFAULT {
RequestTypeFld.Id = utils.REQTYPE
}
if directionFld == nil {
directionFld, _ = utils.NewRSRField(utils.META_DEFAULT)
}
if directionFld.Id == utils.META_DEFAULT {
directionFld.Id = utils.DIRECTION
}
if tenantFld == nil {
tenantFld, _ = utils.NewRSRField(utils.META_DEFAULT)
}
if tenantFld.Id == utils.META_DEFAULT {
tenantFld.Id = utils.TENANT
}
if categFld == nil {
categFld, _ = utils.NewRSRField(utils.META_DEFAULT)
}
if categFld.Id == utils.META_DEFAULT {
categFld.Id = utils.CATEGORY
}
if accountFld == nil {
accountFld, _ = utils.NewRSRField(utils.META_DEFAULT)
}
if accountFld.Id == utils.META_DEFAULT {
accountFld.Id = utils.ACCOUNT
}
if subjectFld == nil {
subjectFld, _ = utils.NewRSRField(utils.META_DEFAULT)
}
if subjectFld.Id == utils.META_DEFAULT {
subjectFld.Id = utils.SUBJECT
}
if destFld == nil {
destFld, _ = utils.NewRSRField(utils.META_DEFAULT)
}
if destFld.Id == utils.META_DEFAULT {
destFld.Id = utils.DESTINATION
}
if setupTimeFld == nil {
setupTimeFld, _ = utils.NewRSRField(utils.META_DEFAULT)
}
if setupTimeFld.Id == utils.META_DEFAULT {
setupTimeFld.Id = utils.SETUP_TIME
}
if answerTimeFld == nil {
answerTimeFld, _ = utils.NewRSRField(utils.META_DEFAULT)
}
if answerTimeFld.Id == utils.META_DEFAULT {
answerTimeFld.Id = utils.ANSWER_TIME
}
if durationFld == nil {
durationFld, _ = utils.NewRSRField(utils.META_DEFAULT)
}
if durationFld.Id == utils.META_DEFAULT {
durationFld.Id = utils.USAGE
}
if PDDFld == nil {
PDDFld, _ = utils.NewRSRField(utils.META_DEFAULT)
}
if PDDFld.Id == utils.META_DEFAULT {
PDDFld.Id = utils.PDD
}
if supplierFld == nil {
supplierFld, _ = utils.NewRSRField(utils.META_DEFAULT)
}
if supplierFld.Id == utils.META_DEFAULT {
supplierFld.Id = utils.SUPPLIER
}
if disconnectCauseFld == nil {
disconnectCauseFld, _ = utils.NewRSRField(utils.META_DEFAULT)
}
if disconnectCauseFld.Id == utils.META_DEFAULT {
disconnectCauseFld.Id = utils.DISCONNECT_CAUSE
}
if ratedFld == nil {
ratedFld, _ = utils.NewRSRField(utils.META_DEFAULT)
}
if ratedFld.Id == utils.META_DEFAULT {
ratedFld.Id = utils.RATED_FLD
}
if costFld == nil {
costFld, _ = utils.NewRSRField(utils.META_DEFAULT)
}
if costFld.Id == utils.META_DEFAULT {
costFld.Id = utils.COST
}
var err error
frkStorCdr := new(CDR)
frkStorCdr.CGRID = cdr.CGRID
frkStorCdr.ToR = cdr.ToR
frkStorCdr.RunID = runId
frkStorCdr.Cost = -1.0 // Default for non-rated CDR
//.........這裏部分代碼省略.........
示例2: ForkCdr
// Used in mediation, primaryMandatory marks whether missing field out of request represents error or can be ignored
func (storedCdr *StoredCdr) ForkCdr(runId string, reqTypeFld, directionFld, tenantFld, categFld, accountFld, subjectFld, destFld, setupTimeFld, pddFld,
answerTimeFld, durationFld, supplierFld, disconnectCauseFld *utils.RSRField,
extraFlds []*utils.RSRField, primaryMandatory bool, timezone string) (*StoredCdr, error) {
if reqTypeFld == nil {
reqTypeFld, _ = utils.NewRSRField(utils.META_DEFAULT)
}
if reqTypeFld.Id == utils.META_DEFAULT {
reqTypeFld.Id = utils.REQTYPE
}
if directionFld == nil {
directionFld, _ = utils.NewRSRField(utils.META_DEFAULT)
}
if directionFld.Id == utils.META_DEFAULT {
directionFld.Id = utils.DIRECTION
}
if tenantFld == nil {
tenantFld, _ = utils.NewRSRField(utils.META_DEFAULT)
}
if tenantFld.Id == utils.META_DEFAULT {
tenantFld.Id = utils.TENANT
}
if categFld == nil {
categFld, _ = utils.NewRSRField(utils.META_DEFAULT)
}
if categFld.Id == utils.META_DEFAULT {
categFld.Id = utils.CATEGORY
}
if accountFld == nil {
accountFld, _ = utils.NewRSRField(utils.META_DEFAULT)
}
if accountFld.Id == utils.META_DEFAULT {
accountFld.Id = utils.ACCOUNT
}
if subjectFld == nil {
subjectFld, _ = utils.NewRSRField(utils.META_DEFAULT)
}
if subjectFld.Id == utils.META_DEFAULT {
subjectFld.Id = utils.SUBJECT
}
if destFld == nil {
destFld, _ = utils.NewRSRField(utils.META_DEFAULT)
}
if destFld.Id == utils.META_DEFAULT {
destFld.Id = utils.DESTINATION
}
if setupTimeFld == nil {
setupTimeFld, _ = utils.NewRSRField(utils.META_DEFAULT)
}
if setupTimeFld.Id == utils.META_DEFAULT {
setupTimeFld.Id = utils.SETUP_TIME
}
if answerTimeFld == nil {
answerTimeFld, _ = utils.NewRSRField(utils.META_DEFAULT)
}
if answerTimeFld.Id == utils.META_DEFAULT {
answerTimeFld.Id = utils.ANSWER_TIME
}
if durationFld == nil {
durationFld, _ = utils.NewRSRField(utils.META_DEFAULT)
}
if durationFld.Id == utils.META_DEFAULT {
durationFld.Id = utils.USAGE
}
if pddFld == nil {
pddFld, _ = utils.NewRSRField(utils.META_DEFAULT)
}
if pddFld.Id == utils.META_DEFAULT {
pddFld.Id = utils.PDD
}
if supplierFld == nil {
supplierFld, _ = utils.NewRSRField(utils.META_DEFAULT)
}
if supplierFld.Id == utils.META_DEFAULT {
supplierFld.Id = utils.SUPPLIER
}
if disconnectCauseFld == nil {
disconnectCauseFld, _ = utils.NewRSRField(utils.META_DEFAULT)
}
if disconnectCauseFld.Id == utils.META_DEFAULT {
disconnectCauseFld.Id = utils.DISCONNECT_CAUSE
}
var err error
frkStorCdr := new(StoredCdr)
frkStorCdr.CgrId = storedCdr.CgrId
frkStorCdr.TOR = storedCdr.TOR
frkStorCdr.MediationRunId = runId
frkStorCdr.Cost = -1.0 // Default for non-rated CDR
frkStorCdr.AccId = storedCdr.AccId
frkStorCdr.CdrHost = storedCdr.CdrHost
frkStorCdr.CdrSource = storedCdr.CdrSource
frkStorCdr.ReqType = storedCdr.FieldAsString(reqTypeFld)
if primaryMandatory && len(frkStorCdr.ReqType) == 0 {
return nil, utils.NewErrMandatoryIeMissing(utils.REQTYPE, reqTypeFld.Id)
}
frkStorCdr.Direction = storedCdr.FieldAsString(directionFld)
if primaryMandatory && len(frkStorCdr.Direction) == 0 {
return nil, utils.NewErrMandatoryIeMissing(utils.DIRECTION, directionFld.Id)
}
frkStorCdr.Tenant = storedCdr.FieldAsString(tenantFld)
//.........這裏部分代碼省略.........