protoc-gen-gorm

command module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

README

protoc-gen-gorm

Tests Linters Go Report Card Maintainability Go Reference

Generate GORM v2 Models and APIs from your .proto files.

protoc-gen-gorm is a plugin for protoc (or buf), a Protocol Buffer ("proto") compiler.

Under active development as of January 2023.

Used in production at GameAnalytics in 2022.

Documentation

Please find the documentation here.

Additionally, there are several code examples, including a full gRPC/REST/CRUD service.

Install

go install github.com/complex64/protoc-gen-gorm@latest

Features

  • Targets Gorm v2 (gorm.io/gorm)
  • Generates GORM-compatible model struct types for your message types: UserModel for your User message
  • Generates methods to convert from proto message to model: ToModel() on the proto message, and ToProto() on the model
  • Generates CRUD helper methods for rapid and convenient implementation of APIs: Create(), Get(), List(), Update(), Patch(), and Delete()
  • Can encode fields as JSON strings when instructed to

Additionally:

  • All features are covered by tests
  • Minimal external dependencies

Planned Features:

  • Support for record lifecycle hooks (on demand)
  • Support for associations
  • Support for custom types
  • Support for database-specific types
  • Support for embedded structs
  • Code examples
  • Helpful code comments
  • Comments on generated code

Contributing

Please have a quick look at CONTRIBUTING.md

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
examples
buf Module
grpc Module
protoc Module
gormpb module
internal
version
Package version records versioning information about this module.
Package version records versioning information about this module.

Jump to

Keyboard shortcuts

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