本文整理汇总了Golang中github.com/kr/pretty.Println函数的典型用法代码示例。如果您正苦于以下问题:Golang Println函数的具体用法?Golang Println怎么用?Golang Println使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Println函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: saveHandler
func saveHandler(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "text/javascipt")
w.Header().Set("Cache-Control", "private, no-cache, no-store, must-revalidate")
w.WriteHeader(204)
err := r.ParseForm()
if err != nil {
log.Printf("Could not parse form: %s", err)
}
data := LogData{}
err = decoder.Decode(&data, r.Form)
if err != nil {
log.Printf("Could decode form: %s", err)
}
data.RemoteIP = remoteIP(r)
data.Time = time.Now().Unix()
data.Referrer = r.Header.Get("Referer")
data.UserAgent = r.Header.Get("User-Agent")
data.Host = r.Host
if idx := strings.Index(data.Host, ":"); idx > 0 {
data.Host = data.Host[0:idx]
}
js, err := json.Marshal(&data)
if err != nil {
log.Printf("Could not marshal json: %s", err)
}
pretty.Println(string(js))
beanCh <- js
}
开发者ID:abh,项目名称:v6test,代码行数:35,代码来源:main.go
示例17: TestClientResolveVersions
func TestClientResolveVersions(t *testing.T) {
t.Skip()
dockerCli, err := dockerclient.New()
if err != nil {
t.Fatal(err)
}
client, err := NewClient(&DockerClient{
Docker: dockerCli,
})
if err != nil {
t.Fatal(err)
}
containers := []*Container{
&Container{
Name: config.NewContainerName("test", "test"),
Image: imagename.NewFromString("golang:1.4.*"),
},
}
if err := client.resolveVersions(true, true, template.Vars{}, containers); err != nil {
t.Fatal(err)
}
pretty.Println(containers)
}
开发者ID:grammarly,项目名称:rocker-compose,代码行数:28,代码来源:client_test.go
示例18: speak
func speak(grammarPath string) error {
// Parse the grammar.
f, err := os.Open(grammarPath)
if err != nil {
return errutil.Err(err)
}
defer f.Close()
grammar, err := ebnf.Parse(filepath.Base(grammarPath), f)
if err != nil {
return errutil.Err(err)
}
if err = ebnf.Verify(grammar, "Program"); err != nil {
return errutil.Err(err)
}
pretty.Println(grammar)
terms := Terminals(grammar)
_ = pretty.Print
//fmt.Println("=== [ Grammar ] ===")
//pretty.Println(grammar)
//fmt.Println("=== [ Terminals ] ===")
//pretty.Println(terms)
fmt.Println("=== [ Regular expressions ] ===")
for _, term := range terms {
//pretty.Println(term)
fmt.Println("term:", RegexpString(grammar, term))
}
return nil
}
开发者ID:mewmew,项目名称:speak,代码行数:35,代码来源:speak.go
示例19: TestPluralIdentifyingRootField_Configuration_ArgNames_WrongArgNameSpecified
func TestPluralIdentifyingRootField_Configuration_ArgNames_WrongArgNameSpecified(t *testing.T) {
t.Skipf("Pending `validator` implementation")
query := `{
usernames(usernamesMisspelled:["dschafer", "leebyron", "schrockn"]) {
username
url
}
}`
expected := &graphql.Result{
Data: nil,
Errors: []gqlerrors.FormattedError{
gqlerrors.FormattedError{
Message: `Unknown argument "usernamesMisspelled" on field "usernames" of type "Query".`,
Locations: []location.SourceLocation{
location.SourceLocation{Line: 2, Column: 17},
},
},
gqlerrors.FormattedError{
Message: `Field "usernames" argument "usernames" of type "[String!]!" is required but not provided.`,
Locations: []location.SourceLocation{
location.SourceLocation{Line: 2, Column: 7},
},
},
},
}
result := graphql.Do(graphql.Params{
Schema: pluralTestSchema,
RequestString: query,
})
pretty.Println(result)
if !reflect.DeepEqual(result, expected) {
t.Fatalf("wrong result, graphql result diff: %v", testutil.Diff(expected, result))
}
}
开发者ID:N0hbdy,项目名称:relay,代码行数:35,代码来源:plural_test.go
示例20: main
func main() {
flag.Usage = func() {
fmt.Fprintf(os.Stderr, "usage: %s [options] Location-Alias\n", path.Base(os.Args[0]))
flag.PrintDefaults()
os.Exit(0)
}
flag.Parse()
if flag.NArg() != 1 {
flag.Usage()
os.Exit(1)
}
client, err := clcv2.NewCLIClient()
if err != nil {
exit.Fatal(err.Error())
}
capa, err := client.GetBareMetalCapabilities(flag.Arg(0))
if err != nil {
exit.Fatalf("failed to query bare-metal capabilities of %s: %s", flag.Arg(0), err)
}
fmt.Printf("Datacenter %s:\n", flag.Arg(0))
pretty.Println(capa)
}
开发者ID:grrtrr,项目名称:clcv2,代码行数:26,代码来源:bare_metal_capabilities.go
注:本文中的github.com/kr/pretty.Println函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论