Skip to content

[Proposal] An ORM Implementation based on Protocol Buffer 3 definition #1

@sadlil

Description

@sadlil

This library intend to design a ORM for go based on the protobuf definitions. This issue intend to have discussion about design and implementation, that needed to be asked and answered.

Most of the ORM design in go is based on struct tags. But generating from protobuf we needed to implement a way to get the tags from the field mappings, with out tagging the structure.
In short the orm should have two basic part -

Generator
Generates code definition, sql statements from protobuf definition. For reference This could follow the pattern of grpc-gateway, that generates go http proxy for gRPC services.
This also includes mapping between protobuf types and sql types.

Generator can heavily use protobuf Message Option and Field Option to take targeted inputs from user specifically indicating sql behaviours for fields indicating column and message indicating table.

For further flexibility generator can also generate sql statements and/or migrations, based on previous definitions and fields serials.
In future that may also generates helper methods to use with library.

Library
Actual implementations of the ORM that uses generated data to integrate with. Can follow pattern based on gorm or xorm two of most popular go orm libraries.

Comments and Suggestion wanted.

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions