iterate

package
v0.7.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 6, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Example (IterateStructTags)
tags := reflect.StructTag(`json:"foo" db:"bar" number:"123"`)

for k, v := range IterateStructTags(tags) {
	fmt.Println(k, "is set to:", v)
}
Output:


json is set to: foo
db is set to: bar
number is set to: 123

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func HasFlag

func HasFlag(flags string, flag string) bool

func IterateChunks

func IterateChunks(s string, sep byte) iter.Seq2[int, string]
Example
var i int
for _, s := range IterateChunks("123,456,789,,,,,", ',') {
	fmt.Println(s)
	i++
}

fmt.Println("count:", i)
Output:


123
456
789
count: 3

func IterateFlags

func IterateFlags(flags string) iter.Seq[string]
Example
for flag := range IterateFlags("foo,bar,baz") {
	fmt.Println(flag)
}
Output:


foo
bar
baz

func IterateStructTags

func IterateStructTags[T ~string](tag T) iter.Seq2[string, string]

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL