frostfs-api-go/util/protogen/internalgengo/writer.go
Evgenii Stratonikov adb7c602d7 [#77] protogen: Initial implementation
Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
2024-08-19 10:47:00 +03:00

30 lines
465 B
Go

package internalgengo
import (
"fmt"
)
type condition = func(string) string
var (
_ condition = notZero
_ condition = notEmpty
_ condition = identity
_ condition = notNil
)
func notZero(name string) string {
return fmt.Sprintf("%s != 0", name)
}
func notEmpty(name string) string {
return fmt.Sprintf("len(%s) != 0", name)
}
func identity(name string) string {
return name
}
func notNil(name string) string {
return fmt.Sprintf("%s != nil", name)
}