entnum

package module
v0.0.0-...-2cffd5a Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2024 License: MIT Imports: 10 Imported by: 0

README

entnum

entviz is an ent extension that provides functions that returns enums.

ent/todo/todo.go

// Status defines the type for the "status" enum field.
type Status string

// Status values.
const (
	StatusOngoing   Status = "ongoing"
	StatusCompleted Status = "completed"
	StatusLater     Status = "later"
)

ent/entnum.go

func AllTodoStatus() []todo.Status {
	return []todo.Status{
		todo.StatusOngoing,
		todo.StatusCompleted,
		todo.StatusLater,
	}
}

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// TemplateFuncs holds the functions that are being used by entnum during generation.
	TemplateFuncs = template.FuncMap{
		"title":              title,
		"isEnum":             isEnum,
		"packagesFromFields": packagesFromField,
	}
)

Functions

This section is empty.

Types

type Extension

type Extension struct {
	entc.DefaultExtension
	// contains filtered or unexported fields
}

func New

func New(opts ...Option) (*Extension, error)

New creates a new entnum.Extension to use with entc.

func (*Extension) Annotations

func (e *Extension) Annotations() []schema.Annotation

func (*Extension) Templates

func (e *Extension) Templates() []*gen.Template

type Option

type Option interface {
	// contains filtered or unexported methods
}

Option for future use.

func Name

func Name(name string) Option

type Retrieve

type Retrieve struct {
	Verb string
}

func (Retrieve) Name

func (r Retrieve) Name() string

Directories

Path Synopsis
test

Jump to

Keyboard shortcuts

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