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

Why we used channel here instead of string/error type #4

Open
imyashkale opened this issue Mar 10, 2023 · 0 comments
Open

Why we used channel here instead of string/error type #4

imyashkale opened this issue Mar 10, 2023 · 0 comments

Comments

@imyashkale
Copy link

imyashkale commented Mar 10, 2023

I saw this kind of uses at many places. Please help me to understand this

`func (r *repository) RegisterRepository(input *model.EntityUsers) (*model.EntityUsers, string) {

var users model.EntityUsers
db := r.db.Model(&users)
errorCode := make(chan string, 1)

checkUserAccount := db.Debug().Select("*").Where("email = ?", input.Email).Find(&users)

if checkUserAccount.RowsAffected > 0 {
	errorCode <- "REGISTER_CONFLICT_409"
	return &users, <-errorCode
} `
@imyashkale imyashkale changed the title Why we used channel here instead of string/error Why we used channel here instead of string/error type Mar 10, 2023
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

No branches or pull requests

1 participant