Documentation
¶
Overview ¶
Example ¶
package main
import (
"context"
"os"
"path/filepath"
"github.com/xoctopus/x/misc/must"
"github.com/xoctopus/genx/pkg/genx"
)
func main() {
cwd := must.NoErrorV(os.Getwd())
entry := filepath.Join(cwd, "..", "testdata", "enumx")
ctx := genx.NewContext(&genx.Args{
Entrypoint: []string{entry},
})
if err := ctx.Execute(context.Background(), genx.Get()...); err != nil {
panic(err)
}
}
Index ¶
- func Span() func() time.Duration
- type Enum
- func (e *Enum) Attr(ctx context.Context, attr, option string) s.Snippet
- func (e *Enum) Attrs() []string
- func (e *Enum) IsValid() bool
- func (e *Enum) StringToValueCases(ctx context.Context) s.Snippet
- func (e *Enum) ValueToStringCases(ctx context.Context) s.Snippet
- func (e *Enum) ValueToTextCases(ctx context.Context) s.Snippet
- func (e *Enum) Values(ctx context.Context) s.Snippet
- type Enums
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Enum ¶
type Enum struct {
// contains filtered or unexported fields
}
func (*Enum) StringToValueCases ¶
StringToValueCases generates code snippet cases from string to const value
func (*Enum) ValueToStringCases ¶
ValueToStringCases generates code snippet cases from enum value to string
func (*Enum) ValueToTextCases ¶
ValueToTextCases generates code snippet cases from enum value to text
Click to show internal directories.
Click to hide internal directories.