casdoor / casdoor-go-sdk

Go client SDK for Casdoor
https://github.com/casdoor/casdoor
Apache License 2.0
82 stars 65 forks source link

Should go sdk provide a NewClient Function and be OOP? #74

Closed wintbiit closed 11 months ago

wintbiit commented 11 months ago

For instance, aliyun oss sdk and gitea go sdk both are OOP, which provide a Client struct and support a NewClient func. This enables them to support multiple sdk clients with different conf exist in the same time.

Can casdoor support Client concept and enable sdk users to connect to multiple casdoor server in the same time?

Example function demand source: https://github.com/casbin/casibase/pull/594#discussion_r1271304392

casbin-bot commented 11 months ago

@seriouszyx @ComradeProgrammer @Resulte

hsluoyz commented 11 months ago

@WinterOfBit good idea. Can you make a PR to support it?

wintbiit commented 11 months ago

@WinterOfBit good idea. Can you make a PR to support it?

@hsluoyz No problem. That would be quite a big api change. But should the original InitConfig func and functions depending on the global config vars be removed or remain as is for now?

hsluoyz commented 11 months ago

@WinterOfBit keep the old usage, both global and client ways can be supported at the same time