infobloxopen / protoc-gen-gorm

A protobuf compiler plugin designed to generate GORM models and APIs for simple object persistence tasks.
Apache License 2.0
549 stars 162 forks source link

How can I disable generate CURD code? #271

Closed honmaple closed 5 months ago

honmaple commented 5 months ago

Thanks for your awesome job.

But I want to generate only GORM struct and disable generate CURD code.In addition to following some special rules, if I want to custom message params, such as

message Pagination {
    int32 page = 1;
    int32 page_size = 2;
}

message ListUsersRequest {
    Pagination pagination = 1;
}

It would be generated to

import (
    ...
    query "github.com/infobloxopen/atlas-app-toolkit/v2/query"
    ...
)

func (m *UserServiceDefaultServer) ListUsers(ctx context.Context, in *ListUsersRequest) (*ListUsersResponse, error) {
    ...
    res, err := DefaultListUser(ctx, db, in.Pagination)
    ...
}

func DefaultListUser(ctx context.Context, db *gorm.DB, p *query.Pagination) ([]*User, error) {
    ...
}

The Pagination is not my defined Pagination, this is very strange and making customization very cumbersome.