Protobuff compiler (protoc) plugin to generate CRUD enabling interfaces and implementations in the Go language.
go install github.com/samlitowitz/protoc-gen-crud/cmd/protoc-gen-go-crud@latest
The protoc-gen-go-crud plugin depends on types generated by the
protoc-gen-go plugin.
Ensure the protoc-gen-go-crud binary is in your path.
As with all protoc plugins the go-crud suffix is the prefix for arguments passed to protoc, i.e.
protoc --go-crud_out=path/to/out path/to/file.proto.
The protoc-gen-go-crud plugin generates an implementation agnostic source file suffixed .pb.crud.go and an
implementation specific source file suffixed .pb.crud.<implementation.go for each implementation.
Example proto files can be found in the test-cases directory.
The protoc-gen-go-crud plugin depends on types generated by the
protoc-gen-go plugin.
Items with a check mark have been implemented Items without a check mark have not been implemented but are planned for implementation.
| Implementation | Create | Read | Update | Delete |
|---|---|---|---|---|
| SQLite | ✅ | ✅ | ✅ | ✅ |
| PgSQL | ✅ | ✅ | ✅ | ✅ |
| Implementation | Hard | Soft |
|---|---|---|
| SQLite | ✅ | |
| PgSQL | ✅ |
| Implementation | Field Mask |
|---|---|
| SQLite | ✅ |
| PgSQL | ✅ |
| Implementation | Created At | Updated At | Deleted At |
|---|---|---|---|
| SQLite | ✅ | ✅ | |
| PgSQL | ✅ | ✅ |
| Implementation | Implemented |
|---|---|
| SQLite | |
| PgSQL |
| Implementation | Single | Composite |
|---|---|---|
| SQLite | ✅ | ✅ |
| PgSQL | ✅ | ✅ |
| Implementation | google.protobuf.Timestamp |
|---|---|
| SQLite | ✅ |
| PgSQL | ✅ |
| Implementation | None | UUID | Sequential Integer |
|---|---|---|---|
| SQLite | ✅ | ||
| PgSQL | ✅ |
| Implementation | Nullable | Not-Nullable |
|---|---|---|
| SQLite | ✅ | |
| PgSQL |
| Implementation | Skip | Inline | Relationship (see below) |
|---|---|---|---|
| SQLite | ✅ | ✅ | - |
| PgSQL | ✅ | ✅ | - |
| Implementation | One-to-one | One-to-many | Many-to-many |
|---|---|---|---|
| SQLite | ✅ | ✅ | ✅ |
| PgSQL | ✅ | ✅ | ✅ |
| Implementation | One-to-one | One-to-many | Many-to-many |
|---|---|---|---|
| SQLite | |||
| PgSQL |
- https://go.dev/blog/protobuf-apiv2
- https://golang.design/research/generic-option/
- https://commandcenter.blogspot.com/2014/01/self-referential-functions-and-design.html
- https://github.com/googleapis/googleapis/blob/master/google/api/http.proto
- https://github.com/grpc-ecosystem/grpc-gateway/tree/main/protoc-gen-openapiv2/options
- https://go.dev/blog/intro-generics
- https://pkg.go.dev/modernc.org/sqlite