Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat:goctl model mongo add easy flag for easy declare. #2073

Merged
merged 6 commits into from Jul 9, 2022
Merged

feat:goctl model mongo add easy flag for easy declare. #2073

merged 6 commits into from Jul 9, 2022

Conversation

czyt
Copy link
Contributor

@czyt czyt commented Jun 30, 2022

with -e ,we will auto generate collection Name and no need a param in Model creation,for example:
create UserModel without e

// NewUserModel returns a model for the mongo.
func NewUserModel(url, db, collection string) UserModel {
	conn := mon.MustNewModel(url, db, collection)
	return &customUserModel{
		defaultUserModel: newDefaultUserModel(conn),
	}
}

create UserModel with e:

const UserCollectionName = "user"
// NewUserModel returns a model for the mongo.
func NewUserModel(url, db string) UserModel {
	conn := mon.MustNewModel(url, db, UserCollectionName)
	return &customUserModel{
		defaultUserModel: newDefaultUserModel(conn),
	}
}

Copy link
Collaborator

@kesonan kesonan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, It's an awesome pull request, thanks you!

@kevwan kevwan merged commit 725e605 into zeromicro:master Jul 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants