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

Double definition of Variable/Function not usable anymore. #691

Open
KyleSanderson opened this issue Jul 29, 2024 · 2 comments
Open

Double definition of Variable/Function not usable anymore. #691

KyleSanderson opened this issue Jul 29, 2024 · 2 comments

Comments

@KyleSanderson
Copy link

Previously I had State(State) == '"'"'stalledUP'"'"'" on github.com/antonmedv/expr v1.12.5

This seems to have been made illegal on a following version (I think v1.13?). I've upgraded to v1.16.9 and it's still a problem.

		expr.Function(
			"State",
			func(params ...any) (any, error) {
				return string(params[0].(qbittorrent.TorrentState)), nil
			},
			new(func(qbittorrent.TorrentState) string),
		),

You've added a lot of functions that I don't need to implement anymore (yay!).

But I still can't figure out how to get around this hack that I added to compare 2 qbittorrent.TorrentStates as you can't call qbittorrent.TorrentState types(?) (qbittorrent.TorrentStateStalledUp) the language.

https://github.com/KyleSanderson/upgraderr/blob/f4ce699f74d33a8f2b6438a6a3edaa8c45de5bb8/main.go#L1300
https://github.com/autobrr/go-qbittorrent/blob/main/domain.go

Help/tips/guidance would be greatly appreciated.

@antonmedv
Copy link
Member

Could you please explain a little bit in more details what you trying to achieve?

@KyleSanderson
Copy link
Author

How do I compare two qbittorrent.TorrentState 's? This change is going to break the interface which is regrettable but I'd much rather resolve the problem then ask people to change State() for the new built-in string()

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

2 participants