本文整理匯總了Golang中github.com/ghemawat/stream.WriteLines函數的典型用法代碼示例。如果您正苦於以下問題:Golang WriteLines函數的具體用法?Golang WriteLines怎麽用?Golang WriteLines使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了WriteLines函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: ExampleSample
func ExampleSample() {
stream.Run(
stream.Numbers(100, 200),
stream.Sample(4),
stream.WriteLines(os.Stdout),
)
// Output not checked since it is non-deterministic.
}
示例2: ExampleColumns
func ExampleColumns() {
stream.Run(
stream.Items("hello world"),
stream.Columns(2, 3, 1),
stream.WriteLines(os.Stdout),
)
// Output:
// world hello
}
示例3: ExampleXargs
func ExampleXargs() {
stream.Run(
stream.Numbers(1, 5),
stream.Xargs("echo"),
stream.WriteLines(os.Stdout),
)
// Output:
// 1 2 3 4 5
}
示例4: ExampleItems
func ExampleItems() {
stream.Run(
stream.Items("hello", "world"),
stream.WriteLines(os.Stdout),
)
// Output:
// hello
// world
}
示例5: ExampleCommand
func ExampleCommand() {
stream.Run(
stream.Numbers(1, 100),
stream.Command("wc", "-l"),
stream.WriteLines(os.Stdout),
)
// Output:
// 100
}
示例6: ExampleCat
func ExampleCat() {
stream.Run(
stream.Cat("stream_test.go"),
stream.Grep("^func ExampleCat"),
stream.WriteLines(os.Stdout),
)
// Output:
// func ExampleCat() {
}
示例7: ExampleReverse
func ExampleReverse() {
stream.Run(
stream.Items("a", "b"),
stream.Reverse(),
stream.WriteLines(os.Stdout),
)
// Output:
// b
// a
}
示例8: ExampleFind
func ExampleFind() {
stream.Run(
stream.Find(".").IfMode(os.FileMode.IsRegular),
stream.Grep("stream"),
stream.WriteLines(os.Stdout),
)
// Output:
// stream.go
// stream_test.go
}
示例9: ExampleNumberLines
func ExampleNumberLines() {
stream.Run(
stream.Items("a", "b"),
stream.NumberLines(),
stream.WriteLines(os.Stdout),
)
// Output:
// 1 a
// 2 b
}
示例10: ExampleFindFilter_SkipDirIf
func ExampleFindFilter_SkipDirIf() {
stream.Run(
stream.Find(".").SkipDirIf(func(d string) bool { return d == ".git" }),
stream.Grep("x"),
stream.WriteLines(os.Stdout),
)
// Output:
// regexp.go
// xargs.go
}
示例11: ExampleDropFirst
func ExampleDropFirst() {
stream.Run(
stream.Numbers(1, 10),
stream.DropFirst(8),
stream.WriteLines(os.Stdout),
)
// Output:
// 9
// 10
}
示例12: ExampleLast
func ExampleLast() {
stream.Run(
stream.Numbers(1, 10),
stream.Last(2),
stream.WriteLines(os.Stdout),
)
// Output:
// 9
// 10
}
示例13: ExampleWriteLines
func ExampleWriteLines() {
stream.Run(
stream.Numbers(1, 3),
stream.WriteLines(os.Stdout),
)
// Output:
// 1
// 2
// 3
}
示例14: ExampleFirst
func ExampleFirst() {
stream.Run(
stream.Numbers(1, 10),
stream.First(3),
stream.WriteLines(os.Stdout),
)
// Output:
// 1
// 2
// 3
}
示例15: ExampleUniqWithCount
func ExampleUniqWithCount() {
stream.Run(
stream.Items("a", "b", "b", "c"),
stream.UniqWithCount(),
stream.WriteLines(os.Stdout),
)
// Output:
// 1 a
// 2 b
// 1 c
}