本文整理匯總了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)
}
示例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)
}
示例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
示例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)
}
示例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)
}
示例6: Debug
func Debug() {
fmt.Println("Config:")
pretty.Println(config)
fmt.Println("Defaults:")
pretty.Println(defaults)
fmt.Println("Override:")
pretty.Println(override)
}
示例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")
}
示例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")))
}
示例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
}
}
示例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
示例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")
}
}
示例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")
}
}
}
示例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)
}
示例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)
}
示例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
}
}
}()
}