Skip to content
This repository was archived by the owner on Mar 24, 2022. It is now read-only.

Repository files navigation

Levo

Code generation for any platform.

Installation

From Source

Run the following commands after you've setup your GO workspace.

go get github.com/cfmobile/levo
go build

Homebrew

brew tap cfmobile/homebrew-tap
brew install levo

Simple Usage

levo -t <templates> -m <model>

e.g. levo -t template.lt -m "User id:long name:string age:int"

Template Example

In the example above, the contents of template.lt looks something like this:

{{$package := .PackageName}}
{{$path := .PackagePath}}
{{range .Models}}
<<levo filename:{{titlecase .Name}}.java directory:src/{{$path}}/models>>
package {{$package}}.models;

import java.util.ArrayList;

public class {{titlecase .Name}} {{if .Parent}}extends {{.Parent}} {{end}}{

	public static class List extends ArrayList<{{titlecase .Name}}> {
		private static final long serialVersionUID = 1L;
	}

	{{range .Properties}}!>
	private {{toJavaType .}} m{{titlecase .LocalIdentifier}};
	{{end}}!>

	{{range .Properties}}!>
	public {{toJavaType .}} get{{titlecase .LocalIdentifier}}() {
		return m{{titlecase .LocalIdentifier}};
	}

	public void set{{titlecase .LocalIdentifier}}({{toJavaType .}} {{camelcase .LocalIdentifier}}) {
		m{{titlecase .LocalIdentifier}} = {{camelcase .LocalIdentifier}};
	}

	{{end}}!>
}
<<levo>>
{{end}}

Existing templates

About

A command line wrapper for the Levo Library

Resources

Security policy

Stars

3 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages