astkit

package
v0.0.0-...-7b6962b Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Array

func Array(typ ast.Expr, elements []ast.Expr) ast.Expr

func ArrayType

func ArrayType(typ ast.Expr) ast.Expr

func AssignStmt

func AssignStmt(variable ast.Expr, value ast.Expr) ast.Stmt

func BinaryExpr

func BinaryExpr(Op token.Token, first ast.Expr, others ...ast.Expr) ast.Expr

func BlockStmt

func BlockStmt(list ...ast.Stmt) *ast.BlockStmt

func Bool

func Bool(val bool) ast.Expr

func Call

func Call(name ast.Expr, args []ast.Expr) ast.Expr

func DefineStmt

func DefineStmt(variable ast.Expr, value ast.Expr) ast.Stmt

func DocComment

func DocComment(comments ...string) *ast.CommentGroup

func ExprStmt

func ExprStmt(expr ast.Expr) ast.Stmt

func False

func False() ast.Expr

func Field

func Field(name *ast.Ident, typ ast.Expr) *ast.Field

func Fields

func Fields(fields ...*ast.Field) *ast.FieldList

func Ident

func Ident(name string) *ast.Ident

func Int

func Int(val int) *ast.BasicLit

func KeyValue

func KeyValue(key string, value ast.Expr) *ast.KeyValueExpr

func MethodCallExpr

func MethodCallExpr(instance ast.Expr, method string, args []ast.Expr) ast.Expr

func MultiAssignStmt

func MultiAssignStmt(variables []ast.Expr, value ast.Expr) ast.Stmt

func MultiDefineStmt

func MultiDefineStmt(variables []ast.Expr, value ast.Expr) ast.Stmt

func Nil

func Nil() *ast.Ident

lit

func Not

func Not(expr ast.Expr) ast.Expr

func PrintNode

func PrintNode(node ast.Node) string

func RefType

func RefType(typ ast.Expr) ast.Expr

func ReturnStmt

func ReturnStmt(results ...ast.Expr) *ast.ReturnStmt

func String

func String(val string) *ast.BasicLit

func Struct

func Struct(fields ...ast.Expr) ast.Expr

func True

func True() ast.Expr

func Type

func Type(name string) ast.Expr

func VarDecl

func VarDecl(doc *ast.CommentGroup, variable *ast.Ident, value ast.Expr) *ast.GenDecl

Types

type FileBuilder

type FileBuilder struct {
	// contains filtered or unexported fields
}

FileBuilder

func NewFileBuilder

func NewFileBuilder(name string, pkg string) *FileBuilder

func (*FileBuilder) AddDecl

func (b *FileBuilder) AddDecl(decl ast.Decl)

func (*FileBuilder) BuildFile

func (b *FileBuilder) BuildFile() *ast.File

func (*FileBuilder) PkgIdent

func (b *FileBuilder) PkgIdent(pkg string, name string) ast.Expr

expr

func (*FileBuilder) Written

func (b *FileBuilder) Written() bool

type Imports

type Imports struct {
	// contains filtered or unexported fields
}

Imports

func (*Imports) Build

func (imports *Imports) Build() *ast.GenDecl

func (*Imports) FindOrAdd

func (imports *Imports) FindOrAdd(pkgName string) string

Jump to

Keyboard shortcuts

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