...
  
    Package foreach
    
  
	
	
		
		
		
		
			
				
			
			
				
				run a function for each ...
				
			
 
		 
		
		
			
		
		
			
		
			
			
			
			
			
				
				- func File(dirname string, recursive bool, fnc func(string, string, string, bool, os.FileInfo)) error
 
			
				
				- func JSON(str string, handler func(*string, *int, *interface{}, int)) error
 
			
				
				- func Struct(sstruct interface{}, handler func(string, string, interface{}, int))
 
			
			
			
			
			 
		
		
		
		
			Package files
			
			
			
				foreach.go
			
			
			
		
		 
		 
		
		
		
		
			
			
			
			func File(dirname string, recursive bool, fnc func(string, string, string, bool, os.FileInfo)) error
			
			
			
		
			
			
			
			func JSON(str string, handler func(*string, *int, *interface{}, int)) error
			
			
			
		
			
			
			
			func Struct(sstruct interface{}, handler func(string, string, interface{}, int))
			
			
	
	
		▾ Example
		
		
		
			Code:
			package foreach_test
import (
    "fmt"
    "simonwaldherr.de/go/golibs/foreach"
)
type Foobar struct {
    X int
    Y int
}
type Foo struct {
    Id    int
    Name  string
    Lorem Foobar
    Ipsum interface{}
    Query func()
}
func ExampleStruct() {
    foreach.Struct(Foo{
        Id:   5,
        Name: "Foobar",
        Lorem: Foobar{
            X: 42,
            Y: 23,
        },
        Ipsum: float64(2),
        Query: func() {
            fmt.Println("---")
        },
    }, func(key string, index string, value interface{}, depth int) {
        fmt.Printf("name: %v, type: %v, depth: %v\n", key, index, depth)
    })
    
    
    
    
    
    
    
    
}