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


Golang pretty.Println函數代碼示例

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


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

示例1: TestDownloadCampaignPerformaceReport

func TestDownloadCampaignPerformaceReport(t *testing.T) {
	ru := testReportUtils(t)

	predicates := []Predicate{
		{"CampaignId", "EQUALS", []string{"246257700"}},
	}

	reportDefinition := &ReportDefinition{
		Selector: Selector{
			Fields: []string{
				"CampaignId",
				"AverageCpc",
				"AverageCpm",
				"Cost",
				"Clicks",
				"Impressions",
				"Week", //Quarter, Month , Year, Week, Date
			},
			Predicates: predicates,
			DateRange: &DateRange{
				Min: "20150411", //YYYYMMDD
				Max: "20150621", //YYYYMMDD
			},
		},
		ReportName: "Report #553f5265b3d84",
		//		DateRangeType:          DATE_RANGE_ALL_TIME,
		DateRangeType:          DATE_RANGE_CUSTOM_DATE,
		IncludeZeroImpressions: true,
	}
	report, err := ru.DownloadCampaignPerformaceReport(reportDefinition)
	pretty.Println(report)
	pretty.Println(err)
}
開發者ID:Nyarum,項目名稱:gads,代碼行數:33,代碼來源:report_utils_test.go

示例2: TestDownloadBudgetPerformanceReport

func TestDownloadBudgetPerformanceReport(t *testing.T) {
	ru := testReportUtils(t)

	predicates := []Predicate{
		{"AssociatedCampaignId", "EQUALS", []string{"246257700"}},
	}

	reportDefinition := &ReportDefinition{
		Selector: Selector{
			Fields: []string{
				"AssociatedCampaignId",
				"AverageCpc",
				"AverageCpm",
				"Cost",
				"Clicks",
				"Impressions",
				"Conversions",
			},
			Predicates: predicates,
		},
		ReportName:             "Report #553f5265b3d84",
		DateRangeType:          DATE_RANGE_ALL_TIME,
		IncludeZeroImpressions: true,
	}
	report, err := ru.DownloadBudgetPerformanceReport(reportDefinition)
	pretty.Println(report)
	pretty.Println(err)
}
開發者ID:Nyarum,項目名稱:gads,代碼行數:28,代碼來源:report_utils_test.go

示例3: FindVideos

func FindVideos(searchfield string, searchcondition string) []Videos {

	session, err := mgo.Dial("mongodb://pak:[email protected]:47335/heroku_wd4cw55m") //session is a session
	if err != nil {
		panic(err)
	}
	defer session.Close()

	var videos []Videos
	// Optional. Switch the session to a monotonic behavior.
	//session.SetMode(mgo.Monotonic, true)
	videos_collection := session.DB("heroku_wd4cw55m").C("videos") //videos is the collection
	fmt.Printf("inside FindVideos: %s and %s\n", searchfield, searchcondition)

	//err = videos_collection.Find(bson.M{"title": "my video"}).All(&videos)
	err = videos_collection.Find(bson.M{searchfield: searchcondition}).All(&videos)

	pretty.Println("inside FindVideos error:%s ", err)

	//     if err != nil {
	//              return err
	//       }
	fmt.Printf("inside FindVideos: %v  \n", videos)
	pretty.Println("Videos:", videos)

	for _, res := range videos {
		fmt.Printf("res: %v\n", res)
	}
	return videos
} // end of FindVideos
開發者ID:kwanp1,項目名稱:cyberdor_test,代碼行數:30,代碼來源:repo.go

示例4: TestAnnotation

// @Swagger
// @Title Api
// @Description Super api
// @Term Dont use
// @Contact name="witoo harianto" url=http://www.plimble.com [email protected]
// @License name="Apache 2.0" url=http://google.com
// @Version 1.1.1
// @Schemes http https ws
// @Consumes json xml
// @Produces json xml
// @Security petstore_auth=write:pets,read:pets
//
// @SecurityDefinition petstore_auth
// @Type oauth2
// @Flow password
// @TokenUrl http://swagger.io/api/oauth/token
// @Scopes write:pets="modify pets in your account" read:pets="read your pets"
//
// @GlobalParam 	userParam		 name=user		required description="sadsadsad"		in=body schema.$ref=arlong.Hello9
// @GlobalParam 	userParam2		 name=user		required description="sadsadsad"		in=body schema.$ref=arlong.Hello9
//
// @GlobalResponse notFound desc="Entity not found." schema.$ref=arlong.Hello9
// @GlobalResponse notFound2 desc="Entity not found." schema.$ref=arlong.Hello9
//
// @Path /attempts
// @Method GET
// @Description Get Array of attempts
// @OperationId GetAttempts
// @Param $ref=limitQuery
// @Param $ref=skipQuery
// @Param $ref=spokenQuery
// @Param $ref=practiseQuery
// @Param $ref=userLangQuery
// @Tags attempts
// @Response 200 schema.type=array schema.items.$ref=arlong.Hello9
//
// @Path /user/jack/{id}
// @Method GET
// @Param name=id required description="sadsadsad" in=path type=string
// @Param name=user required description="sadsadsad" in=body schema.$ref=arlong.Hello9
// @Produces json
// @Consumes json
// @Summary this is summary
// @Description this is description
// @Deprecated
// @Schemes http https
// @OperationId GetStart
// @Tags a b c
// @Security petstore_auth=write:pets,read:pets
// @Response 200 desc=123123 schema.$ref=arlong.Hello9
func TestAnnotation(t *testing.T) {
	basePath := "/Users/witooh/dev/go/src/github.com/plimble/arlong"
	parser := NewParser(basePath)
	b, _ := parser.JSON()
	pretty.Println(string(b))
	pretty.Println(swagger.Definitions)
}
開發者ID:marcw,項目名稱:arlong,代碼行數:57,代碼來源:parser_test.go

示例5: Debug

func (manager *Config) Debug() {
	fmt.Println("Flags:")
	pretty.Println(manager.pflags)
	fmt.Println("Env:")
	pretty.Println(manager.env)
	fmt.Println("Config file attributes:")
	pretty.Println(manager.attributes)
}
開發者ID:MightyE,項目名稱:confer,代碼行數:8,代碼來源:confer.go

示例6: Debug

func Debug() {
	fmt.Println("Config:")
	pretty.Println(config)
	fmt.Println("Defaults:")
	pretty.Println(defaults)
	fmt.Println("Override:")
	pretty.Println(override)
}
開發者ID:victorcoder,項目名稱:viper,代碼行數:8,代碼來源:viper.go

示例7: TestParse

func TestParse(t *testing.T) {
	p, _ := os.Getwd()
	dir := path.Join(p, "testparse")
	pretty.Println(dir)
	parser := NewParser()
	parser.ParseDir(dir)
	pretty.Println(parser.Types)
	// parser.ParseDir("/Users/witooh/dev/go/src/github.com/hyperworks/langfight/src/models")
}
開發者ID:peak6,項目名稱:utils,代碼行數:9,代碼來源:parse_test.go

示例8: main

func main() {
	client, err := redis.Dial("tcp", "192.168.59.103:6379")
	if err != nil {
		log.Fatal(err)
	}

	pretty.Println(client.Do("SET", "hola", "booom"))
	pretty.Println(redis.String(client.Do("GET", "hola")))
}
開發者ID:sent-hil,項目名稱:learn,代碼行數:9,代碼來源:redis.go

示例9: prettyPrint

func prettyPrint(encrypted []byte, key string, label string) {
	var decrypted, err = decrypt(encrypted, key, label)

	if err != nil {
		return
	}

	var model1 models.DesiredLRPRunInfo
	err = model1.Unmarshal(decrypted)
	if err != nil {
		// NOP
	} else {
		pretty.Println(model1)
		return
	}

	var model2 models.DesiredLRPSchedulingInfo
	err = model2.Unmarshal(decrypted)
	if err != nil {
		// NOP
	} else {
		pretty.Println(model2)
		return
	}

	var model3 models.ActualLRP
	err = model3.Unmarshal(decrypted)
	if err != nil {
		// NOP
	} else {
		pretty.Println(model3)
		return
	}

	var model4 models.Task
	err = model4.Unmarshal(decrypted)
	if err != nil {
		// NOP
	} else {
		pretty.Println(model4)
		return
	}

	var model5 models.DesiredLRP
	err = model5.Unmarshal(decrypted)
	if err != nil {
		log.Println("Unknown data type: ", string(decrypted))
	} else {
		pretty.Println(model5)
		return
	}
}
開發者ID:kei-yamazaki,項目名稱:bbsDecryptor,代碼行數:52,代碼來源:main.go

示例10: DeleteUser

func DeleteUser(searchfield string, searchcondition string) bool {

	err = MColusers.Remove(bson.M{searchfield: searchcondition})

	pretty.Println("inside DeleteUser error:%s ", err)

	if err != nil {
		pretty.Println("inside FindUsers error:%s ", err)
		return false
	}
	fmt.Printf("inside DeleteUser/n")

	return true
} // end of DeleteUser
開發者ID:kwanp1,項目名稱:cyberdor_api,代碼行數:14,代碼來源:repo.go

示例11: TestValueScanOk

func TestValueScanOk(t *testing.T) {
	s := testScanner(testValueInput)
	var values []MozValue
	for s.ScanValue() {
		values = append(values, s.Value())
	}
	if err := s.ScanValueError(); err != nil {
		t.Fatal("Unexpected error", err)
	}
	if !reflect.DeepEqual(valScanTestExpected, values) {
		pretty.Println("expected", valScanTestExpected)
		pretty.Println("actual  ", values)
		t.Error("Did not receive expected values")
	}
}
開發者ID:gwatts,項目名稱:rootcerts,代碼行數:15,代碼來源:parse_test.go

示例12: testAdapter

func testAdapter(messages <-chan string, done <-chan bool) {

	// create a new nsqadapter
	queue := nsqAdapter.New("test", nsqlookupd)

	// initialize the ability to handle responses
	queue.InitializeResponseHandling()

	// subscribe to a certain topic
	webserverChan := make(chan nsqAdapter.Message)
	queue.Subscribe("webserver", "requests", webserverChan)

	for {
		select {
		case info := <-webserverChan:
			pretty.Println("WEBSERVER:", info.Payload)

			if info.MessageType == nsqAdapter.MessageTypeRequest {
				queue.RespondTo(info, "this is a response")
			}

		case message := <-messages:
			data := strings.Split(message, ".")

			if data[1] == "request" {

				go func() {
					pretty.Println("REQUEST:", data[0], data[2])
					// create a request  a request
					result, err := queue.SendRequest(data[0], data[2], time.Second*10)

					if err != nil {
						pretty.Println("RESPONSE:", err.Error())
					} else {
						pretty.Println("RESPONSE:", result)
					}
				}()

			} else {
				pretty.Println("PUBLISH:", data[0], data[1])
				queue.Publish(data[0], data[1])
			}

		case <-done:
			fmt.Println("STOPPING QUEUE")
		}
	}
}
開發者ID:ibmendoza,項目名稱:nsq-adapter,代碼行數:48,代碼來源:test.go

示例13: dump

func dump(fn string) {
	fmt.Println("===", fn, "===")
	defer fmt.Println()

	f, err := os.Open(fn)
	if err != nil {
		fmt.Println(err)
		return
	}
	defer f.Close()

	g, err := gzip.NewReader(f)
	if err != nil {
		fmt.Println(err)
		return
	}
	defer g.Close()

	var data interface{}
	err = gob.NewDecoder(g).Decode(&data)
	if err != nil {
		fmt.Println(err)
		return
	}

	pretty.Println(data)
}
開發者ID:BenLubar,項目名稱:Rnoadm,代碼行數:27,代碼來源:main.go

示例14: Debug

func (c *Config) Debug() {
	fmt.Println("Aliases:")
	pretty.Println(c.aliases)
	// fmt.Println("Override:")
	// pretty.Println(c.override)
	// fmt.Println("PFlags")
	// pretty.Println(c.pflags)
	// fmt.Println("Env:")
	// pretty.Println(c.env)
	// fmt.Println("Key/Value Store:")
	// pretty.Println(c.kvstore)
	fmt.Println("Config:")
	pretty.Println(c.config)
	fmt.Println("Defaults:")
	pretty.Println(c.defaults)
}
開發者ID:nwlucas,項目名稱:cfg,代碼行數:16,代碼來源:cfg.go

示例15: Start

// Start runs a go routine which is ready for accepting tasks
func (w Worker) Start() {
	go func() {
		for {
			// Add ourselves into the worker queue.
			w.WorkerQueue <- w.Work
			select {
			case work := <-w.Work:
				// Receive a work request.
				var uProfile jesus.UProfile
				remoteDBConn, err := RemoteDB()
				pretty.Println(work)
				if err != nil {
					w.Stop()
				}
				for _, v := range work {
					fmt.Println("working on deposits for ", v.SenderNumber)
					uProfile = jesus.UProfile{}
					err = remoteDBConn.Where(&jesus.UProfile{Phone: v.SenderNumber}).First(&uProfile).Error
					if err != nil {
						w.Stop()
					}
					uProfile.PrepareDeposit(&v)
					remoteDBConn.Save(&uProfile)
					fmt.Println("====done===")
				}

			case <-w.QuitChan:
				fmt.Printf("worker%d stopping\n", w.ID)
				return
			}
		}
	}()
}
開發者ID:mehulsbhatt,項目名稱:M-PESA-processing,代碼行數:34,代碼來源:worker.go


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