gogen

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package gogen implements the Go client code generator for melange.

This generator produces type-safe Go code from authorization schemas, including object type constants, relation constants, and constructor functions.

Generated code uses the melange runtime (github.com/pthm/melange/melange) for type definitions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Generator

type Generator struct{}

Generator implements clientgen.Generator for Go.

func (*Generator) DefaultConfig

func (g *Generator) DefaultConfig() *clientgen.Config

DefaultConfig returns default configuration for Go code generation.

func (*Generator) Generate

func (g *Generator) Generate(types []schema.TypeDefinition, cfg *clientgen.Config) (map[string][]byte, error)

Generate produces Go client code from the given type definitions.

Returns a single file map entry with key "schema_gen.go".

Generated code includes:

  • ObjectType constants (TypeUser, TypeRepository, etc.)
  • Relation constants (RelCanRead, RelOwner, etc.)
  • Constructor functions (User(id), Repository(id), etc.)
  • Wildcard constructors (AnyUser(), AnyRepository(), etc.)

func (*Generator) Name

func (g *Generator) Name() string

Name returns "go" as the runtime identifier.

Jump to

Keyboard shortcuts

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