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


Golang utils.StringSlicePointer函數代碼示例

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


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

示例1: 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)
	}
}
開發者ID:cgrates,項目名稱:cgrates,代碼行數:25,代碼來源:config_json_test.go

示例2: 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)
	}
}
開發者ID:foehn,項目名稱:cgrates,代碼行數:29,代碼來源:config_json_test.go

示例3: TestDfUserServJsonCfg

func TestDfUserServJsonCfg(t *testing.T) {
	eCfg := &UserServJsonCfg{
		Enabled: utils.BoolPointer(false),
		Indexes: utils.StringSlicePointer([]string{}),
	}
	if cfg, err := dfCgrJsonCfg.UserServJsonCfg(); err != nil {
		t.Error(err)
	} else if !reflect.DeepEqual(eCfg, cfg) {
		t.Error("Received: ", cfg)
	}
}
開發者ID:cgrates,項目名稱:cgrates,代碼行數:11,代碼來源:config_json_test.go

示例4: TestDfDbJsonCfg

func TestDfDbJsonCfg(t *testing.T) {
	eCfg := &DbJsonCfg{
		Db_type:     utils.StringPointer("redis"),
		Db_host:     utils.StringPointer("127.0.0.1"),
		Db_port:     utils.IntPointer(6379),
		Db_name:     utils.StringPointer("10"),
		Db_user:     utils.StringPointer(""),
		Db_password: utils.StringPointer(""),
	}
	if cfg, err := dfCgrJsonCfg.DbJsonCfg(TPDB_JSN); err != nil {
		t.Error(err)
	} else if !reflect.DeepEqual(eCfg, cfg) {
		t.Error("Received: ", cfg)
	}
	eCfg = &DbJsonCfg{
		Db_type:           utils.StringPointer("redis"),
		Db_host:           utils.StringPointer("127.0.0.1"),
		Db_port:           utils.IntPointer(6379),
		Db_name:           utils.StringPointer("11"),
		Db_user:           utils.StringPointer(""),
		Db_password:       utils.StringPointer(""),
		Load_history_size: utils.IntPointer(10),
	}
	if cfg, err := dfCgrJsonCfg.DbJsonCfg(DATADB_JSN); err != nil {
		t.Error(err)
	} else if !reflect.DeepEqual(eCfg, cfg) {
		t.Error("Received: ", cfg)
	}
	eCfg = &DbJsonCfg{
		Db_type:        utils.StringPointer("mysql"),
		Db_host:        utils.StringPointer("127.0.0.1"),
		Db_port:        utils.IntPointer(3306),
		Db_name:        utils.StringPointer("cgrates"),
		Db_user:        utils.StringPointer("cgrates"),
		Db_password:    utils.StringPointer("CGRateS.org"),
		Max_open_conns: utils.IntPointer(100),
		Max_idle_conns: utils.IntPointer(10),
		Cdrs_indexes:   utils.StringSlicePointer([]string{}),
	}
	if cfg, err := dfCgrJsonCfg.DbJsonCfg(STORDB_JSN); err != nil {
		t.Error(err)
	} else if !reflect.DeepEqual(eCfg, cfg) {
		t.Error("Received: ", cfg)
	}
}
開發者ID:cgrates,項目名稱:cgrates,代碼行數:45,代碼來源:config_json_test.go

示例5: 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)
	}
}
開發者ID:foehn,項目名稱:cgrates,代碼行數:18,代碼來源:config_json_test.go

示例6: TestDfCdrsJsonCfg

func TestDfCdrsJsonCfg(t *testing.T) {
	eCfg := &CdrsJsonCfg{
		Enabled:             utils.BoolPointer(false),
		Extra_fields:        utils.StringSlicePointer([]string{}),
		Store_cdrs:          utils.BoolPointer(true),
		Cdr_account_summary: utils.BoolPointer(false),
		Rals_conns: &[]*HaPoolJsonCfg{
			&HaPoolJsonCfg{
				Address: utils.StringPointer("*internal"),
			}},
		Pubsubs_conns:   &[]*HaPoolJsonCfg{},
		Users_conns:     &[]*HaPoolJsonCfg{},
		Aliases_conns:   &[]*HaPoolJsonCfg{},
		Cdrstats_conns:  &[]*HaPoolJsonCfg{},
		Cdr_replication: &[]*CdrReplicationJsonCfg{},
	}
	if cfg, err := dfCgrJsonCfg.CdrsJsonCfg(); err != nil {
		t.Error(err)
	} else if !reflect.DeepEqual(eCfg, cfg) {
		t.Errorf("Received: %+v", *cfg)
	}
}
開發者ID:eloycoto,項目名稱:cgrates,代碼行數:22,代碼來源:config_json_test.go

示例7: TestDiameterAgentJsonCfg

func TestDiameterAgentJsonCfg(t *testing.T) {
	eCfg := &DiameterAgentJsonCfg{
		Enabled:          utils.BoolPointer(false),
		Listen:           utils.StringPointer("127.0.0.1:3868"),
		Dictionaries_dir: utils.StringPointer("/usr/share/cgrates/diameter/dict/"),
		Sm_generic_conns: &[]*HaPoolJsonCfg{
			&HaPoolJsonCfg{
				Address: utils.StringPointer(utils.MetaInternal),
			}},
		Pubsubs_conns:        &[]*HaPoolJsonCfg{},
		Create_cdr:           utils.BoolPointer(true),
		Cdr_requires_session: utils.BoolPointer(true),
		Debit_interval:       utils.StringPointer("5m"),
		Timezone:             utils.StringPointer(""),
		Origin_host:          utils.StringPointer("CGR-DA"),
		Origin_realm:         utils.StringPointer("cgrates.org"),
		Vendor_id:            utils.IntPointer(0),
		Product_name:         utils.StringPointer("CGRateS"),
		Request_processors: &[]*DARequestProcessorJsnCfg{
			&DARequestProcessorJsnCfg{
				Id:                  utils.StringPointer("*default"),
				Dry_run:             utils.BoolPointer(false),
				Publish_event:       utils.BoolPointer(false),
				Request_filter:      utils.StringPointer("Subscription-Id>Subscription-Id-Type(0)"),
				Flags:               utils.StringSlicePointer([]string{}),
				Continue_on_success: utils.BoolPointer(false),
				Append_cca:          utils.BoolPointer(true),
				CCR_fields: &[]*CdrFieldJsonCfg{
					&CdrFieldJsonCfg{Tag: utils.StringPointer("TOR"), Field_id: utils.StringPointer(utils.TOR), Type: utils.StringPointer(utils.META_COMPOSED),
						Value: utils.StringPointer("^*voice"), Mandatory: utils.BoolPointer(true)},
					&CdrFieldJsonCfg{Tag: utils.StringPointer("OriginID"), Field_id: utils.StringPointer(utils.ACCID), Type: utils.StringPointer(utils.META_COMPOSED),
						Value: utils.StringPointer("Session-Id"), Mandatory: utils.BoolPointer(true)},
					&CdrFieldJsonCfg{Tag: utils.StringPointer("RequestType"), Field_id: utils.StringPointer(utils.REQTYPE), Type: utils.StringPointer(utils.META_COMPOSED),
						Value: utils.StringPointer("^*users"), Mandatory: utils.BoolPointer(true)},
					&CdrFieldJsonCfg{Tag: utils.StringPointer("Direction"), Field_id: utils.StringPointer(utils.DIRECTION), Type: utils.StringPointer(utils.META_COMPOSED),
						Value: utils.StringPointer("^*out"), Mandatory: utils.BoolPointer(true)},
					&CdrFieldJsonCfg{Tag: utils.StringPointer("Tenant"), Field_id: utils.StringPointer(utils.TENANT), Type: utils.StringPointer(utils.META_COMPOSED),
						Value: utils.StringPointer("^*users"), Mandatory: utils.BoolPointer(true)},
					&CdrFieldJsonCfg{Tag: utils.StringPointer("Category"), Field_id: utils.StringPointer(utils.CATEGORY), Type: utils.StringPointer(utils.META_COMPOSED),
						Value: utils.StringPointer("^call"), Mandatory: utils.BoolPointer(true)},
					&CdrFieldJsonCfg{Tag: utils.StringPointer("Account"), Field_id: utils.StringPointer(utils.ACCOUNT), Type: utils.StringPointer(utils.META_COMPOSED),
						Value: utils.StringPointer("^*users"), Mandatory: utils.BoolPointer(true)},
					&CdrFieldJsonCfg{Tag: utils.StringPointer("Subject"), Field_id: utils.StringPointer(utils.SUBJECT), Type: utils.StringPointer(utils.META_COMPOSED),
						Value: utils.StringPointer("^*users"), Mandatory: utils.BoolPointer(true)},
					&CdrFieldJsonCfg{Tag: utils.StringPointer("Destination"), Field_id: utils.StringPointer(utils.DESTINATION), Type: utils.StringPointer(utils.META_COMPOSED),
						Value: utils.StringPointer("Service-Information>IN-Information>Real-Called-Number"), Mandatory: utils.BoolPointer(true)},
					&CdrFieldJsonCfg{Tag: utils.StringPointer("SetupTime"), Field_id: utils.StringPointer(utils.SETUP_TIME), Type: utils.StringPointer(utils.META_COMPOSED),
						Value: utils.StringPointer("Event-Timestamp"), Mandatory: utils.BoolPointer(true)},
					&CdrFieldJsonCfg{Tag: utils.StringPointer("AnswerTime"), Field_id: utils.StringPointer(utils.ANSWER_TIME), Type: utils.StringPointer(utils.META_COMPOSED),
						Value: utils.StringPointer("Event-Timestamp"), Mandatory: utils.BoolPointer(true)},
					&CdrFieldJsonCfg{Tag: utils.StringPointer("Usage"), Field_id: utils.StringPointer(utils.USAGE), Type: utils.StringPointer(utils.META_HANDLER),
						Handler_id: utils.StringPointer("*ccr_usage"), Mandatory: utils.BoolPointer(true)},
					&CdrFieldJsonCfg{Tag: utils.StringPointer("SubscriberID"), Field_id: utils.StringPointer("SubscriberId"), Type: utils.StringPointer(utils.META_COMPOSED),
						Value: utils.StringPointer("Subscription-Id>Subscription-Id-Data"), Mandatory: utils.BoolPointer(true)},
				},
				CCA_fields: &[]*CdrFieldJsonCfg{
					&CdrFieldJsonCfg{Tag: utils.StringPointer("GrantedUnits"), Type: utils.StringPointer(utils.META_HANDLER), Handler_id: utils.StringPointer("*cca_usage"),
						Field_id: utils.StringPointer("Granted-Service-Unit>CC-Time"), Mandatory: utils.BoolPointer(true)},
				},
			},
		},
	}
	if cfg, err := dfCgrJsonCfg.DiameterAgentJsonCfg(); err != nil {
		t.Error(err)
	} else if !reflect.DeepEqual(eCfg, cfg) {
		rcv := *cfg.Request_processors
		t.Errorf("Received: %+v", rcv[0].CCA_fields)
	}
}
開發者ID:cgrates,項目名稱:cgrates,代碼行數:69,代碼來源:config_json_test.go


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