Skip to content

tenntenn/optional

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Optional Values for Go

Usage

type Person struct {
    Name string
    Age  int
}

type Query struct {
    Name *String
    Age  *Int
}

func search(q *Query, ps []*Person) []*Person {
    var result []*Person{}
    for _, p := range ps {
        if q.Name.Match(p.Name) && q.Age.Match(p.Age) {
            result = append(result, p)
        }
    }
    return result
}

About

Optional values for Go

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages