本文整理汇总了Golang中github.com/cgrates/cgrates/utils.BoolPointer函数的典型用法代码示例。如果您正苦于以下问题:Golang BoolPointer函数的具体用法?Golang BoolPointer怎么用?Golang BoolPointer使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了BoolPointer函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: TestSmFsJsonCfg
func TestSmFsJsonCfg(t *testing.T) {
eCfg := &SmFsJsonCfg{
Enabled: utils.BoolPointer(false),
Rater: utils.StringPointer("internal"),
Cdrs: utils.StringPointer("internal"),
Create_cdr: utils.BoolPointer(false),
Extra_fields: utils.StringSlicePointer([]string{}),
Debit_interval: utils.StringPointer("10s"),
Min_call_duration: utils.StringPointer("0s"),
Max_call_duration: utils.StringPointer("3h"),
Min_dur_low_balance: utils.StringPointer("5s"),
Low_balance_ann_file: utils.StringPointer(""),
Empty_balance_context: utils.StringPointer(""),
Empty_balance_ann_file: utils.StringPointer(""),
Subscribe_park: utils.BoolPointer(true),
Channel_sync_interval: utils.StringPointer("5m"),
Connections: &[]*FsConnJsonCfg{
&FsConnJsonCfg{
Server: utils.StringPointer("127.0.0.1:8021"),
Password: utils.StringPointer("ClueCon"),
Reconnects: utils.IntPointer(5),
}},
}
if cfg, err := dfCgrJsonCfg.SmFsJsonCfg(); err != nil {
t.Error(err)
} else if !reflect.DeepEqual(eCfg, cfg) {
t.Error("Received: ", cfg)
}
}
示例2: TestSmKamJsonCfg
func TestSmKamJsonCfg(t *testing.T) {
eCfg := &SmKamJsonCfg{
Enabled: utils.BoolPointer(false),
Rals_conns: &[]*HaPoolJsonCfg{
&HaPoolJsonCfg{
Address: utils.StringPointer(utils.MetaInternal),
}},
Cdrs_conns: &[]*HaPoolJsonCfg{
&HaPoolJsonCfg{
Address: utils.StringPointer(utils.MetaInternal),
}},
Create_cdr: utils.BoolPointer(false),
Debit_interval: utils.StringPointer("10s"),
Min_call_duration: utils.StringPointer("0s"),
Max_call_duration: utils.StringPointer("3h"),
Evapi_conns: &[]*KamConnJsonCfg{
&KamConnJsonCfg{
Address: utils.StringPointer("127.0.0.1:8448"),
Reconnects: utils.IntPointer(5),
},
},
}
if cfg, err := dfCgrJsonCfg.SmKamJsonCfg(); err != nil {
t.Error(err)
} else if !reflect.DeepEqual(eCfg, cfg) {
t.Error("Received: ", cfg)
}
}
示例3: TestSmOsipsJsonCfg
func TestSmOsipsJsonCfg(t *testing.T) {
eCfg := &SmOsipsJsonCfg{
Enabled: utils.BoolPointer(false),
Listen_udp: utils.StringPointer("127.0.0.1:2020"),
Rals_conns: &[]*HaPoolJsonCfg{
&HaPoolJsonCfg{
Address: utils.StringPointer(utils.MetaInternal),
}},
Cdrs_conns: &[]*HaPoolJsonCfg{
&HaPoolJsonCfg{
Address: utils.StringPointer(utils.MetaInternal),
}},
Create_cdr: utils.BoolPointer(false),
Debit_interval: utils.StringPointer("10s"),
Min_call_duration: utils.StringPointer("0s"),
Max_call_duration: utils.StringPointer("3h"),
Events_subscribe_interval: utils.StringPointer("60s"),
Mi_addr: utils.StringPointer("127.0.0.1:8020"),
}
if cfg, err := dfCgrJsonCfg.SmOsipsJsonCfg(); err != nil {
t.Error(err)
} else if !reflect.DeepEqual(eCfg, cfg) {
t.Error("Received: ", cfg)
}
}
示例4: TesSmFsConfigLoadFromJsonCfg
func TesSmFsConfigLoadFromJsonCfg(t *testing.T) {
smFsJsnCfg := &SmFsJsonCfg{
Enabled: utils.BoolPointer(true),
Create_cdr: utils.BoolPointer(true),
Subscribe_park: utils.BoolPointer(true),
Connections: &[]*FsConnJsonCfg{
&FsConnJsonCfg{
Server: utils.StringPointer("1.2.3.4:8021"),
Password: utils.StringPointer("ClueCon"),
Reconnects: utils.IntPointer(5),
},
&FsConnJsonCfg{
Server: utils.StringPointer("2.3.4.5:8021"),
Password: utils.StringPointer("ClueCon"),
Reconnects: utils.IntPointer(5),
},
},
}
eSmFsConfig := &SmFsConfig{Enabled: true,
CreateCdr: true,
SubscribePark: true,
Connections: []*FsConnConfig{
&FsConnConfig{Server: "1.2.3.4:8021", Password: "ClueCon", Reconnects: 5},
&FsConnConfig{Server: "1.2.3.4:8021", Password: "ClueCon", Reconnects: 5},
},
}
smFsCfg := new(SmFsConfig)
if err := smFsCfg.loadFromJsonCfg(smFsJsnCfg); err != nil {
t.Error(err)
} else if !reflect.DeepEqual(eSmFsConfig, smFsCfg) {
t.Error("Received: ", smFsCfg)
}
}
示例5: TestNewCgrJsonCfgFromFile
func TestNewCgrJsonCfgFromFile(t *testing.T) {
cgrJsonCfg, err := NewCgrJsonCfgFromFile("cfg_data.json")
if err != nil {
t.Error(err)
}
eCfg := &GeneralJsonCfg{Default_reqtype: utils.StringPointer(utils.META_PSEUDOPREPAID)}
if gCfg, err := cgrJsonCfg.GeneralJsonCfg(); err != nil {
t.Error(err)
} else if !reflect.DeepEqual(eCfg, gCfg) {
t.Error("Received: ", gCfg)
}
cdrFields := []*CdrFieldJsonCfg{
&CdrFieldJsonCfg{Cdr_field_id: utils.StringPointer(utils.TOR), Value: utils.StringPointer("~7:s/^(voice|data|sms|generic)$/*$1/")},
&CdrFieldJsonCfg{Cdr_field_id: utils.StringPointer(utils.ANSWER_TIME), Value: utils.StringPointer("1")},
&CdrFieldJsonCfg{Cdr_field_id: utils.StringPointer(utils.USAGE), Value: utils.StringPointer(`~9:s/^(\d+)$/${1}s/`)},
}
eCfgCdrc := map[string]*CdrcJsonCfg{
"CDRC-CSV1": &CdrcJsonCfg{
Enabled: utils.BoolPointer(true),
Cdr_in_dir: utils.StringPointer("/tmp/cgrates/cdrc1/in"),
Cdr_out_dir: utils.StringPointer("/tmp/cgrates/cdrc1/out"),
Cdr_source_id: utils.StringPointer("csv1"),
},
"CDRC-CSV2": &CdrcJsonCfg{
Enabled: utils.BoolPointer(true),
Data_usage_multiply_factor: utils.Float64Pointer(0.000976563),
Run_delay: utils.IntPointer(1),
Cdr_in_dir: utils.StringPointer("/tmp/cgrates/cdrc2/in"),
Cdr_out_dir: utils.StringPointer("/tmp/cgrates/cdrc2/out"),
Cdr_source_id: utils.StringPointer("csv2"),
Content_fields: &cdrFields,
},
}
if cfg, err := cgrJsonCfg.CdrcJsonCfg(); err != nil {
t.Error(err)
} else if !reflect.DeepEqual(eCfgCdrc, cfg) {
t.Error("Received: ", cfg["CDRC-CSV2"])
}
eCfgSmFs := &SmFsJsonCfg{
Enabled: utils.BoolPointer(true),
Connections: &[]*FsConnJsonCfg{
&FsConnJsonCfg{
Server: utils.StringPointer("1.2.3.4:8021"),
Password: utils.StringPointer("ClueCon"),
Reconnects: utils.IntPointer(5),
},
&FsConnJsonCfg{
Server: utils.StringPointer("2.3.4.5:8021"),
Password: utils.StringPointer("ClueCon"),
Reconnects: utils.IntPointer(5),
},
},
}
if smFsCfg, err := cgrJsonCfg.SmFsJsonCfg(); err != nil {
t.Error(err)
} else if !reflect.DeepEqual(eCfgSmFs, smFsCfg) {
t.Error("Received: ", smFsCfg)
}
}
示例6: TestDfRalsJsonCfg
func TestDfRalsJsonCfg(t *testing.T) {
eCfg := &RalsJsonCfg{Enabled: utils.BoolPointer(false), Balancer: utils.StringPointer(""), Cdrstats_conns: &[]*HaPoolJsonCfg{},
Historys_conns: &[]*HaPoolJsonCfg{}, Pubsubs_conns: &[]*HaPoolJsonCfg{}, Users_conns: &[]*HaPoolJsonCfg{}, Aliases_conns: &[]*HaPoolJsonCfg{},
Rp_subject_prefix_matching: utils.BoolPointer(false), Lcr_subject_prefix_matching: utils.BoolPointer(false)}
if cfg, err := dfCgrJsonCfg.RalsJsonCfg(); err != nil {
t.Error(err)
} else if !reflect.DeepEqual(eCfg, cfg) {
t.Errorf("Received: %+v", cfg)
}
}
示例7: testOnStorITCacheActions
func testOnStorITCacheActions(t *testing.T) {
acts := Actions{
&Action{
Id: "MINI",
ActionType: TOPUP_RESET,
ExpirationString: UNLIMITED,
Weight: 10,
Balance: &BalanceFilter{
Type: utils.StringPointer(utils.MONETARY),
Uuid: utils.StringPointer(utils.GenUUID()),
Directions: utils.StringMapPointer(utils.NewStringMap(utils.OUT)),
Value: &utils.ValueFormula{Static: 10,
Params: make(map[string]interface{})},
Weight: utils.Float64Pointer(10),
Disabled: utils.BoolPointer(false),
Timings: make([]*RITiming, 0),
Blocker: utils.BoolPointer(false),
},
},
&Action{
Id: "MINI",
ActionType: TOPUP,
ExpirationString: UNLIMITED,
Weight: 10,
Balance: &BalanceFilter{
Type: utils.StringPointer(utils.VOICE),
Uuid: utils.StringPointer(utils.GenUUID()),
Directions: utils.StringMapPointer(utils.NewStringMap(utils.OUT)),
Value: &utils.ValueFormula{Static: 100,
Params: make(map[string]interface{})},
Weight: utils.Float64Pointer(10),
RatingSubject: utils.StringPointer("test"),
DestinationIDs: utils.StringMapPointer(utils.NewStringMap("NAT")),
Disabled: utils.BoolPointer(false),
Timings: make([]*RITiming, 0),
Blocker: utils.BoolPointer(false),
},
},
}
if err := onStor.SetActions(acts[0].Id, acts, utils.NonTransactional); err != nil {
t.Error(err)
}
if _, hasIt := cache.Get(utils.ACTION_PREFIX + acts[0].Id); hasIt {
t.Error("Already in cache")
}
if err := onStor.CacheDataFromDB(utils.ACTION_PREFIX, []string{acts[0].Id}, false); err != nil {
t.Error(err)
}
if itm, hasIt := cache.Get(utils.ACTION_PREFIX + acts[0].Id); !hasIt {
t.Error("Did not cache")
} else if rcv := itm.(Actions); !reflect.DeepEqual(acts, rcv) {
t.Errorf("Expecting: %+v, received: %+v", acts, rcv)
}
}
示例8: TestDfGeneralJsonCfg
func TestDfGeneralJsonCfg(t *testing.T) {
eCfg := &GeneralJsonCfg{
Instance_id: utils.StringPointer(""),
Log_level: utils.IntPointer(utils.LOGLEVEL_INFO),
Http_skip_tls_verify: utils.BoolPointer(false),
Rounding_decimals: utils.IntPointer(5),
Dbdata_encoding: utils.StringPointer("msgpack"),
Tpexport_dir: utils.StringPointer("/var/spool/cgrates/tpe"),
Httpposter_attempts: utils.IntPointer(3),
Http_failed_dir: utils.StringPointer("/var/spool/cgrates/http_failed"),
Default_request_type: utils.StringPointer(utils.META_RATED),
Default_category: utils.StringPointer("call"),
Default_tenant: utils.StringPointer("cgrates.org"),
Default_timezone: utils.StringPointer("Local"),
Connect_attempts: utils.IntPointer(3),
Reconnects: utils.IntPointer(-1),
Connect_timeout: utils.StringPointer("1s"),
Reply_timeout: utils.StringPointer("2s"),
Response_cache_ttl: utils.StringPointer("0s"),
Internal_ttl: utils.StringPointer("2m"),
Locking_timeout: utils.StringPointer("5s"),
}
if gCfg, err := dfCgrJsonCfg.GeneralJsonCfg(); err != nil {
t.Error(err)
} else if !reflect.DeepEqual(eCfg, gCfg) {
t.Error("Received: ", utils.ToIJSON(gCfg))
}
}
示例9: TestSmGenericJsonCfg
func TestSmGenericJsonCfg(t *testing.T) {
eCfg := &SmGenericJsonCfg{
Enabled: utils.BoolPointer(false),
Listen_bijson: utils.StringPointer("127.0.0.1:2014"),
Rals_conns: &[]*HaPoolJsonCfg{
&HaPoolJsonCfg{
Address: utils.StringPointer(utils.MetaInternal),
}},
Cdrs_conns: &[]*HaPoolJsonCfg{
&HaPoolJsonCfg{
Address: utils.StringPointer(utils.MetaInternal),
}},
Smg_replication_conns: &[]*HaPoolJsonCfg{},
Debit_interval: utils.StringPointer("0s"),
Min_call_duration: utils.StringPointer("0s"),
Max_call_duration: utils.StringPointer("3h"),
Session_ttl: utils.StringPointer("0s"),
Session_indexes: utils.StringSlicePointer([]string{}),
}
if cfg, err := dfCgrJsonCfg.SmGenericJsonCfg(); err != nil {
t.Error(err)
} else if !reflect.DeepEqual(eCfg, cfg) {
t.Error("Received: ", cfg)
}
}
示例10: TestDfSureTaxJsonCfg
func TestDfSureTaxJsonCfg(t *testing.T) {
eCfg := &SureTaxJsonCfg{
Url: utils.StringPointer(""),
Client_number: utils.StringPointer(""),
Validation_key: utils.StringPointer(""),
Business_unit: utils.StringPointer(""),
Timezone: utils.StringPointer("Local"),
Include_local_cost: utils.BoolPointer(false),
Return_file_code: utils.StringPointer("0"),
Response_group: utils.StringPointer("03"),
Response_type: utils.StringPointer("D4"),
Regulatory_code: utils.StringPointer("03"),
Client_tracking: utils.StringPointer(utils.CGRID),
Customer_number: utils.StringPointer("Subject"),
Orig_number: utils.StringPointer("Subject"),
Term_number: utils.StringPointer("Destination"),
Bill_to_number: utils.StringPointer(""),
Zipcode: utils.StringPointer(""),
Plus4: utils.StringPointer(""),
P2PZipcode: utils.StringPointer(""),
P2PPlus4: utils.StringPointer(""),
Units: utils.StringPointer("^1"),
Unit_type: utils.StringPointer("^00"),
Tax_included: utils.StringPointer("^0"),
Tax_situs_rule: utils.StringPointer("^04"),
Trans_type_code: utils.StringPointer("^010101"),
Sales_type_code: utils.StringPointer("^R"),
Tax_exemption_code_list: utils.StringPointer(""),
}
if cfg, err := dfCgrJsonCfg.SureTaxJsonCfg(); err != nil {
t.Error(err)
} else if !reflect.DeepEqual(eCfg, cfg) {
t.Error("Received: ", cfg)
}
}
示例11: TestSmAsteriskJsonCfg
func TestSmAsteriskJsonCfg(t *testing.T) {
eCfg := &SMAsteriskJsonCfg{
Enabled: utils.BoolPointer(false),
Sm_generic_conns: &[]*HaPoolJsonCfg{
&HaPoolJsonCfg{
Address: utils.StringPointer(utils.MetaInternal),
}},
Session_terminate_subscriber: &HaPoolJsonCfg{Address: utils.StringPointer(utils.MetaInternal)},
Debit_interval: utils.StringPointer("10s"),
Min_call_duration: utils.StringPointer("0s"),
Max_call_duration: utils.StringPointer("3h"),
Asterisk_conns: &[]*AstConnJsonCfg{
&AstConnJsonCfg{
Address: utils.StringPointer("127.0.0.1:8088"),
User: utils.StringPointer("cgrates"),
Password: utils.StringPointer("CGRateS.org"),
Connect_attempts: utils.IntPointer(3),
Reconnects: utils.IntPointer(5),
},
},
}
if cfg, err := dfCgrJsonCfg.SmAsteriskJsonCfg(); err != nil {
t.Error(err)
} else if !reflect.DeepEqual(eCfg, cfg) {
t.Error("Received: ", cfg)
}
}
示例12: TestDfSchedulerJsonCfg
func TestDfSchedulerJsonCfg(t *testing.T) {
eCfg := &SchedulerJsonCfg{Enabled: utils.BoolPointer(false)}
if cfg, err := dfCgrJsonCfg.SchedulerJsonCfg(); err != nil {
t.Error(err)
} else if !reflect.DeepEqual(eCfg, cfg) {
t.Error("Received: ", cfg)
}
}
示例13: TestDfCdrsJsonCfg
func TestDfCdrsJsonCfg(t *testing.T) {
eCfg := &CdrsJsonCfg{
Enabled: utils.BoolPointer(false),
Extra_fields: utils.StringSlicePointer([]string{}),
Store_cdrs: utils.BoolPointer(true),
Rater: utils.StringPointer("internal"),
Pubsubs: utils.StringPointer(""),
Users: utils.StringPointer(""),
Aliases: utils.StringPointer(""),
Cdrstats: utils.StringPointer(""),
Cdr_replication: &[]*CdrReplicationJsonCfg{},
}
if cfg, err := dfCgrJsonCfg.CdrsJsonCfg(); err != nil {
t.Error(err)
} else if !reflect.DeepEqual(eCfg, cfg) {
t.Errorf("Received: %+v", *cfg)
}
}
示例14: TestDfRaterJsonCfg
func TestDfRaterJsonCfg(t *testing.T) {
eCfg := &RaterJsonCfg{Enabled: utils.BoolPointer(false), Balancer: utils.StringPointer(""), Cdrstats: utils.StringPointer(""),
Historys: utils.StringPointer(""), Pubsubs: utils.StringPointer(""), Users: utils.StringPointer(""), Aliases: utils.StringPointer("")}
if cfg, err := dfCgrJsonCfg.RaterJsonCfg(); err != nil {
t.Error(err)
} else if !reflect.DeepEqual(eCfg, cfg) {
t.Errorf("Received: %+v", cfg)
}
}
示例15: TestDfCdrStatsJsonCfg
func TestDfCdrStatsJsonCfg(t *testing.T) {
eCfg := &CdrStatsJsonCfg{
Enabled: utils.BoolPointer(false),
Save_Interval: utils.StringPointer("1m"),
}
if cfg, err := dfCgrJsonCfg.CdrStatsJsonCfg(); err != nil {
t.Error(err)
} else if !reflect.DeepEqual(eCfg, cfg) {
t.Error("Received: ", *cfg)
}
}