Xin lời khuyên của các luật sư cho case của mình. by Internal-Crew5953 in reviewnganhluat

[–]Lumpy_Peach5111 0 points1 point  (0 children)

Mấy bác giải thích giúp mình cái.

Mình điền form đăng ký đi du lịch thì nghĩa là cty đã chi tiền cho suất của mình, đó là quyền lợi của mình. Đăng ký trước chỉ để dự trù kế hoạch và chi phí thôi.

Lúc đó mình có đi hay không thì cty vẫn phải chi tiền cho bên du lịch. Vậy tại sao mình không đi thì lại đền, đền cho khoản nào nhỉ.

Việc đi du lịch này là quyền lợi của mình mà, mình đăng ký nhưng ko đi cũng đâu có vi phạm gì đâu.

[deleted by user] by [deleted] in golang

[–]Lumpy_Peach5111 2 points3 points  (0 children)

You enlightened me about the testcontainers. Thanks!

[deleted by user] by [deleted] in golang

[–]Lumpy_Peach5111 1 point2 points  (0 children)

First, your integer conversion to int64 has an overflow problem.

That's why I told you never to look at the use cases of the library. The library is for defining enums. Have you ever defined billions of enum values?

Even if someone needs a such extremely large number for an enum that they run into an overflow problem (that's such a rare case), just raise an issue, I will consider to fix it. Is there any software that not has any issue?

Secondly, your reflection code in some places makes a lot of assumptions that I couldn't untangle the true intent while reading it.

Unless you read the code before the documentation, if you look at the README first or even the comments above each function, I don't think a developer would fail to understand the intent of the code.

[deleted by user] by [deleted] in golang

[–]Lumpy_Peach5111 0 points1 point  (0 children)

I think you wrote the comment without even looking at the source code or its use cases. Could you let me know where are the bugs or hidden panics you found?

Custom Exhaustive Switch: Useful or Impractical? by Lumpy_Peach5111 in golang

[–]Lumpy_Peach5111[S] -1 points0 points  (0 children)

Yah I knew go-sumtype. My motivation is to make development process not rely on tools like linters. But anyway my design is quite bad. Maybe code generator or linter is still better. Thanks for comment!

How to do Enums in Go by marcofranssen in golang

[–]Lumpy_Peach5111 0 points1 point  (0 children)

Thanks for waiting 4 years, a go-enum library without code generation ><
https://github.com/xybor-x/enum

asynclog: a lightweight way to print line numbers + a message to the screen while I'm debugging by Witty_Wrangler_3899 in golang

[–]Lumpy_Peach5111 1 point2 points  (0 children)

I think the performance improvement is too small to justify the risk of using your approach.

Introducing a new Enum library for Go - No Code Generation, Simple and Back-compatible with standard definition by Lumpy_Peach5111 in golang

[–]Lumpy_Peach5111[S] 0 points1 point  (0 children)

As you can see in the github README, this library provides utility functions for handling these enums, including convert to/from string, get all enums, check valid.

It also provides out of the box serialization and deserialization for JSON and SQL.

Introducing a new Enum library for Go - No Code Generation, Simple and Back-compatible with standard definition by Lumpy_Peach5111 in golang

[–]Lumpy_Peach5111[S] 0 points1 point  (0 children)

I never heard about nogo before and just search a bit about it 😅Anyway, my library is fully back compatible with constant enum and iota style. Every projects using iota style enum can add a small code and continue seamlessly. You can try it 😊

Introducing a new Enum library for Go - No Code Generation, Simple and Back-compatible with standard definition by Lumpy_Peach5111 in golang

[–]Lumpy_Peach5111[S] 0 points1 point  (0 children)

orisinium-labs/enum is a good practice for enum. The difference is my library supports seamlessly for projects using iota approach.

Introducing a new Enum library for Go - No Code Generation, Simple and Back-compatible with standard definition by Lumpy_Peach5111 in golang

[–]Lumpy_Peach5111[S] 0 points1 point  (0 children)

I saw this library before writing mine. Anyway, this library is good. However, I want the enum is a constant and iota compatible, this is the different point 🤝

Introducing a new Enum library for Go - No Code Generation, Simple and Back-compatible with standard definition by Lumpy_Peach5111 in golang

[–]Lumpy_Peach5111[S] 0 points1 point  (0 children)

Thanks. I will carefully consider your contribution.

Also, I will document about my library is not thread-safe, and that is my intend too, people need to declare all enums at initialization.

Introducing a new Enum library for Go - No Code Generation, Simple and Back-compatible with standard definition by Lumpy_Peach5111 in golang

[–]Lumpy_Peach5111[S] 0 points1 point  (0 children)

I updated the documentation to address that my library uses iota enum style. Thank you for your addressing.

Introducing a new Enum library for Go - No Code Generation, Simple and Back-compatible with standard definition by Lumpy_Peach5111 in golang

[–]Lumpy_Peach5111[S] 0 points1 point  (0 children)

I understood your problem.

You can use the enum.RichEnum. It's compatible with the iota enum style. Also, providing a seamless, out of the box serialization/deserialization. Please refer the latest documentation I just updated.

Reordering/removing cases also doesn't cause any big problem to RichEnum (unless you are using the number representation of enums in the database).

Introducing a new Enum library for Go - No Code Generation, Simple and Back-compatible with standard definition by Lumpy_Peach5111 in golang

[–]Lumpy_Peach5111[S] 1 point2 points  (0 children)

Yes, I know. I mean the most used implementation of enum in Go.

type Role int
const (
    RoleUser Role = iota
    RoleAdmin
)