modusgraph-gen

module
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2026 License: Apache-2.0

README

modusgraph-gen

Code generation and the wrapper-entity runtime for modusgraph. Define Go structs, run go generate, and get a fully typed client, query builders, auto-paging iterators, and a CLI — all derived from your struct definitions.

modusgraph-gen was extracted from a fork of modusGraph. The generic typed client and query primitives stay in modusGraph; this project owns the generator and the entity wrapper base that generated code embeds.

Install

modusgraph-gen depends on a fork of modusGraph that is published under a different import path. Go does not propagate replace directives to consumers, so your project must declare the same replace directive:

// go.mod
require (
    github.com/mlwelles/modusgraph-gen v0.1.0
    github.com/matthewmcneely/modusgraph v0.0.0-00010101000000-000000000000
)

replace github.com/matthewmcneely/modusgraph => github.com/mlwelles/modusGraph v0.5.0-dev-mlwelles-20260604a

Without this directive, the build resolves matthewmcneely/modusgraph to upstream, which lacks the typed client and bulk loader the generated code depends on.

Usage

Add a go:generate directive next to your schema structs:

//go:generate go run github.com/mlwelles/modusgraph-gen/cmd/modusgraph-gen -entities

then run go generate ./....

Generated code imports the generic primitives from modusgraph/typed and the wrapper base from modusgraph-gen/wrap:

import (
    "github.com/matthewmcneely/modusgraph/typed"
    "github.com/mlwelles/modusgraph-gen/wrap"
)

License

Apache-2.0. See LICENSE and NOTICE.

Directories

Path Synopsis
cmd
modusgraph-gen command
modusGraphGen is a code generation tool that reads Go structs with dgraph struct tags and produces a typed client library, functional options, query builders, and a Kong CLI.
modusGraphGen is a code generation tool that reads Go structs with dgraph struct tags and produces a typed client library, functional options, query builders, and a Kong CLI.
modusgraph-gen/internal/generator
Package generator executes code-generation templates against a parsed model to produce typed client libraries.
Package generator executes code-generation templates against a parsed model to produce typed client libraries.
modusgraph-gen/internal/model
Package model defines the intermediate representation used between the parser and the code generator.
Package model defines the intermediate representation used between the parser and the code generator.
modusgraph-gen/internal/parser
Package parser extracts entity and field metadata from Go source files by inspecting struct declarations and their struct tags.
Package parser extracts entity and field metadata from Go source files by inspecting struct declarations and their struct tags.

Jump to

Keyboard shortcuts

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