Compare commits
No commits in common. "main" and "v0.0.2" have entirely different histories.
15
go.mod
15
go.mod
|
@ -5,8 +5,8 @@ go 1.23.0
|
||||||
toolchain go1.23.10
|
toolchain go1.23.10
|
||||||
|
|
||||||
require (
|
require (
|
||||||
git.nobla.cn/golang/aeus v0.0.11
|
git.nobla.cn/golang/aeus v0.0.8
|
||||||
git.nobla.cn/golang/rest v0.1.4
|
git.nobla.cn/golang/rest v0.1.2
|
||||||
github.com/envoyproxy/protoc-gen-validate v1.2.1
|
github.com/envoyproxy/protoc-gen-validate v1.2.1
|
||||||
golang.org/x/text v0.23.0 // indirect
|
golang.org/x/text v0.23.0 // indirect
|
||||||
google.golang.org/protobuf v1.36.6
|
google.golang.org/protobuf v1.36.6
|
||||||
|
@ -20,9 +20,6 @@ require (
|
||||||
golang.org/x/sync v0.12.0
|
golang.org/x/sync v0.12.0
|
||||||
google.golang.org/genproto/googleapis/api v0.0.0-20250303144028-a0af3efb3deb
|
google.golang.org/genproto/googleapis/api v0.0.0-20250303144028-a0af3efb3deb
|
||||||
google.golang.org/grpc v1.72.2
|
google.golang.org/grpc v1.72.2
|
||||||
gopkg.in/yaml.v3 v3.0.1
|
|
||||||
gorm.io/driver/postgres v1.6.0
|
|
||||||
gorm.io/driver/sqlite v1.6.0
|
|
||||||
)
|
)
|
||||||
|
|
||||||
require (
|
require (
|
||||||
|
@ -41,22 +38,15 @@ require (
|
||||||
github.com/go-sql-driver/mysql v1.8.1 // indirect
|
github.com/go-sql-driver/mysql v1.8.1 // indirect
|
||||||
github.com/goccy/go-json v0.10.2 // indirect
|
github.com/goccy/go-json v0.10.2 // indirect
|
||||||
github.com/google/uuid v1.6.0 // indirect
|
github.com/google/uuid v1.6.0 // indirect
|
||||||
github.com/jackc/pgpassfile v1.0.0 // indirect
|
|
||||||
github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 // indirect
|
|
||||||
github.com/jackc/pgx/v5 v5.6.0 // indirect
|
|
||||||
github.com/jackc/puddle/v2 v2.2.2 // indirect
|
|
||||||
github.com/jinzhu/inflection v1.0.0 // indirect
|
github.com/jinzhu/inflection v1.0.0 // indirect
|
||||||
github.com/jinzhu/now v1.1.5 // indirect
|
github.com/jinzhu/now v1.1.5 // indirect
|
||||||
github.com/json-iterator/go v1.1.12 // indirect
|
github.com/json-iterator/go v1.1.12 // indirect
|
||||||
github.com/klauspost/cpuid/v2 v2.2.7 // indirect
|
github.com/klauspost/cpuid/v2 v2.2.7 // indirect
|
||||||
github.com/kr/text v0.2.0 // indirect
|
|
||||||
github.com/leodido/go-urn v1.4.0 // indirect
|
github.com/leodido/go-urn v1.4.0 // indirect
|
||||||
github.com/mattn/go-isatty v0.0.20 // indirect
|
github.com/mattn/go-isatty v0.0.20 // indirect
|
||||||
github.com/mattn/go-sqlite3 v1.14.22 // indirect
|
|
||||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
|
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
|
||||||
github.com/modern-go/reflect2 v1.0.2 // indirect
|
github.com/modern-go/reflect2 v1.0.2 // indirect
|
||||||
github.com/pelletier/go-toml/v2 v2.2.2 // indirect
|
github.com/pelletier/go-toml/v2 v2.2.2 // indirect
|
||||||
github.com/rogpeppe/go-internal v1.14.1 // indirect
|
|
||||||
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
|
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
|
||||||
github.com/ugorji/go/codec v1.2.12 // indirect
|
github.com/ugorji/go/codec v1.2.12 // indirect
|
||||||
golang.org/x/arch v0.8.0 // indirect
|
golang.org/x/arch v0.8.0 // indirect
|
||||||
|
@ -64,4 +54,5 @@ require (
|
||||||
golang.org/x/net v0.38.0 // indirect
|
golang.org/x/net v0.38.0 // indirect
|
||||||
golang.org/x/sys v0.31.0 // indirect
|
golang.org/x/sys v0.31.0 // indirect
|
||||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20250303144028-a0af3efb3deb // indirect
|
google.golang.org/genproto/googleapis/rpc v0.0.0-20250303144028-a0af3efb3deb // indirect
|
||||||
|
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||||
)
|
)
|
||||||
|
|
32
go.sum
32
go.sum
|
@ -1,11 +1,11 @@
|
||||||
filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA=
|
filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA=
|
||||||
filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4=
|
filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4=
|
||||||
git.nobla.cn/golang/aeus v0.0.11 h1:gbXIOVOQRDTIQTjw9wPVfNC9nXBaTJCABeDYmrHW2Oc=
|
git.nobla.cn/golang/aeus v0.0.8 h1:mifdMOredbOfUNnP193+IjR1gR68O+2R3DVEhi3N4GE=
|
||||||
git.nobla.cn/golang/aeus v0.0.11/go.mod h1:oOEwqIp6AhKKqj6sLFO8x7IycOROYHCb/2/CjF4+9CU=
|
git.nobla.cn/golang/aeus v0.0.8/go.mod h1:oOEwqIp6AhKKqj6sLFO8x7IycOROYHCb/2/CjF4+9CU=
|
||||||
git.nobla.cn/golang/kos v0.1.32 h1:sFVCA7vKc8dPUd0cxzwExOSPX2mmMh2IuwL6cYS1pBc=
|
git.nobla.cn/golang/kos v0.1.32 h1:sFVCA7vKc8dPUd0cxzwExOSPX2mmMh2IuwL6cYS1pBc=
|
||||||
git.nobla.cn/golang/kos v0.1.32/go.mod h1:35Z070+5oB39WcVrh5DDlnVeftL/Ccmscw2MZFe9fUg=
|
git.nobla.cn/golang/kos v0.1.32/go.mod h1:35Z070+5oB39WcVrh5DDlnVeftL/Ccmscw2MZFe9fUg=
|
||||||
git.nobla.cn/golang/rest v0.1.4 h1:9/XscfNXI3aPESpy8CPtVl17VSMxU9BihhedeG+h8YY=
|
git.nobla.cn/golang/rest v0.1.2 h1:vF5perbveRcCF5Pb60yxHjvGpx/zX+D1qzdceqIwg+E=
|
||||||
git.nobla.cn/golang/rest v0.1.4/go.mod h1:4viDk7VujDokpUeHQGbnSp2bkkVZEoIkWQIs/l/TTPQ=
|
git.nobla.cn/golang/rest v0.1.2/go.mod h1:4viDk7VujDokpUeHQGbnSp2bkkVZEoIkWQIs/l/TTPQ=
|
||||||
github.com/bytedance/sonic v1.11.6 h1:oUp34TzMlL+OY1OUWxHqsdkgC/Zfc85zGqw9siXjrc0=
|
github.com/bytedance/sonic v1.11.6 h1:oUp34TzMlL+OY1OUWxHqsdkgC/Zfc85zGqw9siXjrc0=
|
||||||
github.com/bytedance/sonic v1.11.6/go.mod h1:LysEHSvpvDySVdC2f87zGWf6CIKJcAvqab1ZaiQtds4=
|
github.com/bytedance/sonic v1.11.6/go.mod h1:LysEHSvpvDySVdC2f87zGWf6CIKJcAvqab1ZaiQtds4=
|
||||||
github.com/bytedance/sonic/loader v0.1.1 h1:c+e5Pt1k/cy5wMveRDyk2X4B9hF4g7an8N3zCYjJFNM=
|
github.com/bytedance/sonic/loader v0.1.1 h1:c+e5Pt1k/cy5wMveRDyk2X4B9hF4g7an8N3zCYjJFNM=
|
||||||
|
@ -14,7 +14,6 @@ github.com/cloudwego/base64x v0.1.4 h1:jwCgWpFanWmN8xoIUHa2rtzmkd5J2plF/dnLS6Xd/
|
||||||
github.com/cloudwego/base64x v0.1.4/go.mod h1:0zlkT4Wn5C6NdauXdJRhSKRlJvmclQ1hhJgA0rcu/8w=
|
github.com/cloudwego/base64x v0.1.4/go.mod h1:0zlkT4Wn5C6NdauXdJRhSKRlJvmclQ1hhJgA0rcu/8w=
|
||||||
github.com/cloudwego/iasm v0.2.0 h1:1KNIy1I1H9hNNFEEH3DVnI4UujN+1zjpuk6gwHLTssg=
|
github.com/cloudwego/iasm v0.2.0 h1:1KNIy1I1H9hNNFEEH3DVnI4UujN+1zjpuk6gwHLTssg=
|
||||||
github.com/cloudwego/iasm v0.2.0/go.mod h1:8rXZaNYT2n95jn+zTI1sDr+IgcD2GVs0nlbbQPiEFhY=
|
github.com/cloudwego/iasm v0.2.0/go.mod h1:8rXZaNYT2n95jn+zTI1sDr+IgcD2GVs0nlbbQPiEFhY=
|
||||||
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
|
|
||||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
|
@ -51,14 +50,6 @@ github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeN
|
||||||
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
|
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
|
||||||
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
|
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
|
||||||
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||||
github.com/jackc/pgpassfile v1.0.0 h1:/6Hmqy13Ss2zCq62VdNG8tM1wchn8zjSGOBJ6icpsIM=
|
|
||||||
github.com/jackc/pgpassfile v1.0.0/go.mod h1:CEx0iS5ambNFdcRtxPj5JhEz+xB6uRky5eyVu/W2HEg=
|
|
||||||
github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 h1:iCEnooe7UlwOQYpKFhBabPMi4aNAfoODPEFNiAnClxo=
|
|
||||||
github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761/go.mod h1:5TJZWKEWniPve33vlWYSoGYefn3gLQRzjfDlhSJ9ZKM=
|
|
||||||
github.com/jackc/pgx/v5 v5.6.0 h1:SWJzexBzPL5jb0GEsrPMLIsi/3jOo7RHlzTjcAeDrPY=
|
|
||||||
github.com/jackc/pgx/v5 v5.6.0/go.mod h1:DNZ/vlrUnhWCoFGxHAG8U2ljioxukquj7utPDgtQdTw=
|
|
||||||
github.com/jackc/puddle/v2 v2.2.2 h1:PR8nw+E/1w0GLuRFSmiioY6UooMp6KJv0/61nB7icHo=
|
|
||||||
github.com/jackc/puddle/v2 v2.2.2/go.mod h1:vriiEXHvEE654aYKXXjOvZM39qJ0q+azkZFrfEOc3H4=
|
|
||||||
github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD/E=
|
github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD/E=
|
||||||
github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc=
|
github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc=
|
||||||
github.com/jinzhu/now v1.1.5 h1:/o9tlHleP7gOFmsnYNz3RGnqzefHA47wQpKrrdTIwXQ=
|
github.com/jinzhu/now v1.1.5 h1:/o9tlHleP7gOFmsnYNz3RGnqzefHA47wQpKrrdTIwXQ=
|
||||||
|
@ -69,16 +60,10 @@ github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa02
|
||||||
github.com/klauspost/cpuid/v2 v2.2.7 h1:ZWSB3igEs+d0qvnxR/ZBzXVmxkgt8DdzP6m9pfuVLDM=
|
github.com/klauspost/cpuid/v2 v2.2.7 h1:ZWSB3igEs+d0qvnxR/ZBzXVmxkgt8DdzP6m9pfuVLDM=
|
||||||
github.com/klauspost/cpuid/v2 v2.2.7/go.mod h1:Lcz8mBdAVJIBVzewtcLocK12l3Y+JytZYpaMropDUws=
|
github.com/klauspost/cpuid/v2 v2.2.7/go.mod h1:Lcz8mBdAVJIBVzewtcLocK12l3Y+JytZYpaMropDUws=
|
||||||
github.com/knz/go-libedit v1.10.1/go.mod h1:MZTVkCWyz0oBc7JOWP3wNAzd002ZbM/5hgShxwh4x8M=
|
github.com/knz/go-libedit v1.10.1/go.mod h1:MZTVkCWyz0oBc7JOWP3wNAzd002ZbM/5hgShxwh4x8M=
|
||||||
github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0=
|
|
||||||
github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk=
|
|
||||||
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
|
|
||||||
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
|
|
||||||
github.com/leodido/go-urn v1.4.0 h1:WT9HwE9SGECu3lg4d/dIA+jxlljEa1/ffXKmRjqdmIQ=
|
github.com/leodido/go-urn v1.4.0 h1:WT9HwE9SGECu3lg4d/dIA+jxlljEa1/ffXKmRjqdmIQ=
|
||||||
github.com/leodido/go-urn v1.4.0/go.mod h1:bvxc+MVxLKB4z00jd1z+Dvzr47oO32F/QSNjSBOlFxI=
|
github.com/leodido/go-urn v1.4.0/go.mod h1:bvxc+MVxLKB4z00jd1z+Dvzr47oO32F/QSNjSBOlFxI=
|
||||||
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
|
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
|
||||||
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
|
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
|
||||||
github.com/mattn/go-sqlite3 v1.14.22 h1:2gZY6PC6kBnID23Tichd1K+Z0oS6nE/XwU+Vz/5o4kU=
|
|
||||||
github.com/mattn/go-sqlite3 v1.14.22/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y=
|
|
||||||
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
||||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg=
|
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg=
|
||||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
||||||
|
@ -90,8 +75,6 @@ github.com/pelletier/go-toml/v2 v2.2.2 h1:aYUidT7k73Pcl9nb2gScu7NSrKCSHIDE89b3+6
|
||||||
github.com/pelletier/go-toml/v2 v2.2.2/go.mod h1:1t835xjRzz80PqgE6HHgN2JOsmgYu/h4qDAS4n929Rs=
|
github.com/pelletier/go-toml/v2 v2.2.2/go.mod h1:1t835xjRzz80PqgE6HHgN2JOsmgYu/h4qDAS4n929Rs=
|
||||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||||
github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ=
|
|
||||||
github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc=
|
|
||||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||||
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
|
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
|
||||||
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
|
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
|
||||||
|
@ -143,18 +126,13 @@ google.golang.org/grpc v1.72.2 h1:TdbGzwb82ty4OusHWepvFWGLgIbNo1/SUynEN0ssqv8=
|
||||||
google.golang.org/grpc v1.72.2/go.mod h1:wH5Aktxcg25y1I3w7H69nHfXdOG3UiadoBtjh3izSDM=
|
google.golang.org/grpc v1.72.2/go.mod h1:wH5Aktxcg25y1I3w7H69nHfXdOG3UiadoBtjh3izSDM=
|
||||||
google.golang.org/protobuf v1.36.6 h1:z1NpPI8ku2WgiWnf+t9wTPsn6eP1L7ksHUlkfLvd9xY=
|
google.golang.org/protobuf v1.36.6 h1:z1NpPI8ku2WgiWnf+t9wTPsn6eP1L7ksHUlkfLvd9xY=
|
||||||
google.golang.org/protobuf v1.36.6/go.mod h1:jduwjTPXsFjZGTmRluh+L6NjiWu7pchiJ2/5YcXBHnY=
|
google.golang.org/protobuf v1.36.6/go.mod h1:jduwjTPXsFjZGTmRluh+L6NjiWu7pchiJ2/5YcXBHnY=
|
||||||
|
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
|
||||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
|
|
||||||
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
|
|
||||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||||
gorm.io/driver/mysql v1.6.0 h1:eNbLmNTpPpTOVZi8MMxCi2aaIm0ZpInbORNXDwyLGvg=
|
gorm.io/driver/mysql v1.6.0 h1:eNbLmNTpPpTOVZi8MMxCi2aaIm0ZpInbORNXDwyLGvg=
|
||||||
gorm.io/driver/mysql v1.6.0/go.mod h1:D/oCC2GWK3M/dqoLxnOlaNKmXz8WNTfcS9y5ovaSqKo=
|
gorm.io/driver/mysql v1.6.0/go.mod h1:D/oCC2GWK3M/dqoLxnOlaNKmXz8WNTfcS9y5ovaSqKo=
|
||||||
gorm.io/driver/postgres v1.6.0 h1:2dxzU8xJ+ivvqTRph34QX+WrRaJlmfyPqXmoGVjMBa4=
|
|
||||||
gorm.io/driver/postgres v1.6.0/go.mod h1:vUw0mrGgrTK+uPHEhAdV4sfFELrByKVGnaVRkXDhtWo=
|
|
||||||
gorm.io/driver/sqlite v1.6.0 h1:WHRRrIiulaPiPFmDcod6prc4l2VGVWHz80KspNsxSfQ=
|
|
||||||
gorm.io/driver/sqlite v1.6.0/go.mod h1:AO9V1qIQddBESngQUKWL9yoH93HIeA1X6V633rBwyT8=
|
|
||||||
gorm.io/gorm v1.30.0 h1:qbT5aPv1UH8gI99OsRlvDToLxW5zR7FzS9acZDOZcgs=
|
gorm.io/gorm v1.30.0 h1:qbT5aPv1UH8gI99OsRlvDToLxW5zR7FzS9acZDOZcgs=
|
||||||
gorm.io/gorm v1.30.0/go.mod h1:8Z33v652h4//uMA76KjeDH8mJXPm1QNCYrMeatR0DOE=
|
gorm.io/gorm v1.30.0/go.mod h1:8Z33v652h4//uMA76KjeDH8mJXPm1QNCYrMeatR0DOE=
|
||||||
nullprogram.com/x/optparse v1.0.0/go.mod h1:KdyPE+Igbe0jQUrVfMqDMeJQIJZEuyV7pjYmp6pbG50=
|
nullprogram.com/x/optparse v1.0.0/go.mod h1:KdyPE+Igbe0jQUrVfMqDMeJQIJZEuyV7pjYmp6pbG50=
|
||||||
|
|
|
@ -94,6 +94,6 @@ func NewDepartmentLogic(db *gorm.DB, ch cache.Cache) *Department {
|
||||||
return &Department{
|
return &Department{
|
||||||
db: db,
|
db: db,
|
||||||
cache: ch,
|
cache: ch,
|
||||||
sqlDependency: dbcache.NewSqlDependency("SELECT MAX(`updated_at`) FROM `departments`"),
|
sqlDependency: dbcache.NewSqlDependency("SELECT MAX(`updated_at`) FROM departments"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,6 +44,6 @@ func NewMenuLogic(db *gorm.DB, ch cache.Cache) *Menu {
|
||||||
return &Menu{
|
return &Menu{
|
||||||
db: db,
|
db: db,
|
||||||
cache: ch,
|
cache: ch,
|
||||||
sqlDependency: dbcache.NewSqlDependency("SELECT MAX(`updated_at`) FROM `menus`"),
|
sqlDependency: dbcache.NewSqlDependency("SELECT MAX(`updated_at`) FROM menus"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,7 +59,7 @@ func NewRoleLogic(db *gorm.DB, ch cache.Cache) *Role {
|
||||||
return &Role{
|
return &Role{
|
||||||
db: db,
|
db: db,
|
||||||
cache: ch,
|
cache: ch,
|
||||||
sqlDependency: dbcache.NewSqlDependency("SELECT MAX(`updated_at`) FROM `roles`"),
|
sqlDependency: dbcache.NewSqlDependency("SELECT MAX(`updated_at`) FROM roles"),
|
||||||
permissionSqlDependency: dbcache.NewSqlDependency("SELECT MAX(`updated_at`) FROM `permissions`"),
|
permissionSqlDependency: dbcache.NewSqlDependency("SELECT MAX(`updated_at`) FROM permissions"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,6 @@ type User struct {
|
||||||
db *gorm.DB
|
db *gorm.DB
|
||||||
cache cache.Cache
|
cache cache.Cache
|
||||||
sqlDependency *dbcache.SqlDependency
|
sqlDependency *dbcache.SqlDependency
|
||||||
roleDependency *dbcache.SqlDependency
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetPermissions 获取用户权限
|
// GetPermissions 获取用户权限
|
||||||
|
@ -31,8 +30,7 @@ func (u *User) GetPermissions(ctx context.Context, uid string) (permissions []st
|
||||||
Error
|
Error
|
||||||
return ss, err
|
return ss, err
|
||||||
},
|
},
|
||||||
dbcache.WithDependency(u.roleDependency),
|
dbcache.WithCacheDuration(time.Minute),
|
||||||
dbcache.WithCacheDuration(time.Second*20),
|
|
||||||
dbcache.WithDB(u.db),
|
dbcache.WithDB(u.db),
|
||||||
dbcache.WithCache(u.cache),
|
dbcache.WithCache(u.cache),
|
||||||
)
|
)
|
||||||
|
@ -69,7 +67,6 @@ func NewUserLogic(db *gorm.DB, ch cache.Cache) *User {
|
||||||
return &User{
|
return &User{
|
||||||
db: db,
|
db: db,
|
||||||
cache: ch,
|
cache: ch,
|
||||||
roleDependency: dbcache.NewSqlDependency("SELECT COUNT(*) AS count FROM `role_permissions`"),
|
sqlDependency: dbcache.NewSqlDependency("SELECT MAX(`updated_at`) FROM users"),
|
||||||
sqlDependency: dbcache.NewSqlDependency("SELECT MAX(`updated_at`) FROM `users`"),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,7 +48,6 @@ func init() {
|
||||||
orgMenu.Name = "Organize"
|
orgMenu.Name = "Organize"
|
||||||
orgMenu.Public = true
|
orgMenu.Public = true
|
||||||
orgMenu.Uri = "/organize"
|
orgMenu.Uri = "/organize"
|
||||||
orgMenu.Position = 1
|
|
||||||
|
|
||||||
profileMenu := &models.Menu{}
|
profileMenu := &models.Menu{}
|
||||||
profileMenu.Label = "个人信息"
|
profileMenu.Label = "个人信息"
|
||||||
|
@ -65,7 +64,6 @@ func init() {
|
||||||
settingMenu.Name = "System"
|
settingMenu.Name = "System"
|
||||||
settingMenu.Public = true
|
settingMenu.Public = true
|
||||||
settingMenu.Uri = "/system"
|
settingMenu.Uri = "/system"
|
||||||
settingMenu.Position = 999
|
|
||||||
|
|
||||||
schemaMenu := &models.Menu{}
|
schemaMenu := &models.Menu{}
|
||||||
schemaMenu.Label = "字段设置"
|
schemaMenu.Label = "字段设置"
|
||||||
|
|
|
@ -8,19 +8,12 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
// Menu 合并菜单
|
// Menu 合并菜单
|
||||||
func Menu(db *gorm.DB, datas ...*models.Menu) (err error) {
|
func Menu(db *gorm.DB, model *models.Menu) (err error) {
|
||||||
tx := db.Begin()
|
if err = db.Where("name = ?", model.Name).First(model).Error; err != nil {
|
||||||
for _, model := range datas {
|
|
||||||
if err = tx.Where("name = ?", model.Name).First(model).Error; err != nil {
|
|
||||||
if errors.Is(err, gorm.ErrRecordNotFound) {
|
if errors.Is(err, gorm.ErrRecordNotFound) {
|
||||||
if err = tx.Create(model).Error; err != nil {
|
err = db.Create(model).Error
|
||||||
tx.Rollback()
|
|
||||||
return err
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
err = tx.Commit().Error
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,7 +31,6 @@ func Permission(db *gorm.DB, menuName string, permission string, label string) (
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// #2c7be5
|
|
||||||
// Default 合并初始化数据集
|
// Default 合并初始化数据集
|
||||||
func Default(db *gorm.DB) (err error) {
|
func Default(db *gorm.DB) (err error) {
|
||||||
var (
|
var (
|
||||||
|
|
|
@ -1,12 +1,9 @@
|
||||||
package models
|
package models
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
|
||||||
|
|
||||||
"git.nobla.cn/golang/aeus-admin/pb"
|
"git.nobla.cn/golang/aeus-admin/pb"
|
||||||
"git.nobla.cn/golang/aeus-admin/types"
|
"git.nobla.cn/golang/aeus-admin/types"
|
||||||
restTypes "git.nobla.cn/golang/rest/types"
|
restTypes "git.nobla.cn/golang/rest/types"
|
||||||
"gorm.io/gorm"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type (
|
type (
|
||||||
|
@ -56,7 +53,7 @@ func (m *Login) GetMenu() *types.Menu {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *Login) Scenario() []string {
|
func (m *Login) Scenario() []string {
|
||||||
return []string{restTypes.ScenarioList, restTypes.ScenarioExport}
|
return []string{restTypes.ScenarioList}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *Menu) GetMenu() *types.Menu {
|
func (m *Menu) GetMenu() *types.Menu {
|
||||||
|
@ -66,17 +63,6 @@ func (m *Menu) GetMenu() *types.Menu {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *Menu) BeforeDelete(tx *gorm.DB) (err error) {
|
|
||||||
var count int64
|
|
||||||
if err = tx.Model(&Menu{}).Where("`parent` = ?", m.Name).Count(&count).Error; err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if count > 0 {
|
|
||||||
err = errors.New("please delete sub menus first")
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *Menu) ModelPermissions() map[string]string {
|
func (m *Menu) ModelPermissions() map[string]string {
|
||||||
return map[string]string{
|
return map[string]string{
|
||||||
"organize:permission:list": "权限",
|
"organize:permission:list": "权限",
|
||||||
|
@ -90,23 +76,6 @@ func (m *Department) GetMenu() *types.Menu {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *Department) BeforeDelete(tx *gorm.DB) (err error) {
|
|
||||||
var count int64
|
|
||||||
if err = tx.Model(&Department{}).Where("`parent_id` = ?", m.Id).Count(&count).Error; err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if count > 0 {
|
|
||||||
return errors.New("please delete sub department first")
|
|
||||||
}
|
|
||||||
if err = tx.Model(&User{}).Where("`dept_id` = ?", m.Id).Count(&count).Error; err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if count > 0 {
|
|
||||||
err = errors.New("please delete user first")
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *Role) GetMenu() *types.Menu {
|
func (m *Role) GetMenu() *types.Menu {
|
||||||
return &types.Menu{
|
return &types.Menu{
|
||||||
Name: "OrganizeRole",
|
Name: "OrganizeRole",
|
||||||
|
@ -120,17 +89,6 @@ func (m *Role) ModelPermissions() map[string]string {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *Role) BeforeDelete(tx *gorm.DB) (err error) {
|
|
||||||
var count int64
|
|
||||||
if err = tx.Model(&User{}).Where("`role` = ?", m.Name).Count(&count).Error; err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if count > 0 {
|
|
||||||
err = errors.New("please delete user first")
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *Permission) GetMenu() *types.Menu {
|
func (m *Permission) GetMenu() *types.Menu {
|
||||||
return &types.Menu{
|
return &types.Menu{
|
||||||
Name: "OrganizePermission",
|
Name: "OrganizePermission",
|
||||||
|
@ -178,7 +136,7 @@ func (m *Activity) GetMenu() *types.Menu {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *Activity) Scenario() []string {
|
func (m *Activity) Scenario() []string {
|
||||||
return []string{restTypes.ScenarioList, restTypes.ScenarioExport}
|
return []string{restTypes.ScenarioList}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *Activity) ModuleName() string {
|
func (m *Activity) ModuleName() string {
|
||||||
|
|
|
@ -961,27 +961,27 @@ func (x *MenuItem) GetChildren() []*MenuItem {
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取菜单的请求
|
// 获取菜单的请求
|
||||||
type GetUserMenuRequest struct {
|
type GetMenuRequest struct {
|
||||||
state protoimpl.MessageState `protogen:"open.v1"`
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
Permission bool `protobuf:"varint,1,opt,name=permission,proto3" json:"permission,omitempty"`
|
Permission bool `protobuf:"varint,1,opt,name=permission,proto3" json:"permission,omitempty"`
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
sizeCache protoimpl.SizeCache
|
sizeCache protoimpl.SizeCache
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *GetUserMenuRequest) Reset() {
|
func (x *GetMenuRequest) Reset() {
|
||||||
*x = GetUserMenuRequest{}
|
*x = GetMenuRequest{}
|
||||||
mi := &file_organize_proto_msgTypes[10]
|
mi := &file_organize_proto_msgTypes[10]
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
ms.StoreMessageInfo(mi)
|
ms.StoreMessageInfo(mi)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *GetUserMenuRequest) String() string {
|
func (x *GetMenuRequest) String() string {
|
||||||
return protoimpl.X.MessageStringOf(x)
|
return protoimpl.X.MessageStringOf(x)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (*GetUserMenuRequest) ProtoMessage() {}
|
func (*GetMenuRequest) ProtoMessage() {}
|
||||||
|
|
||||||
func (x *GetUserMenuRequest) ProtoReflect() protoreflect.Message {
|
func (x *GetMenuRequest) ProtoReflect() protoreflect.Message {
|
||||||
mi := &file_organize_proto_msgTypes[10]
|
mi := &file_organize_proto_msgTypes[10]
|
||||||
if x != nil {
|
if x != nil {
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
@ -993,12 +993,12 @@ func (x *GetUserMenuRequest) ProtoReflect() protoreflect.Message {
|
||||||
return mi.MessageOf(x)
|
return mi.MessageOf(x)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Deprecated: Use GetUserMenuRequest.ProtoReflect.Descriptor instead.
|
// Deprecated: Use GetMenuRequest.ProtoReflect.Descriptor instead.
|
||||||
func (*GetUserMenuRequest) Descriptor() ([]byte, []int) {
|
func (*GetMenuRequest) Descriptor() ([]byte, []int) {
|
||||||
return file_organize_proto_rawDescGZIP(), []int{10}
|
return file_organize_proto_rawDescGZIP(), []int{10}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *GetUserMenuRequest) GetPermission() bool {
|
func (x *GetMenuRequest) GetPermission() bool {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
return x.Permission
|
return x.Permission
|
||||||
}
|
}
|
||||||
|
@ -1006,27 +1006,27 @@ func (x *GetUserMenuRequest) GetPermission() bool {
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取菜单的响应
|
// 获取菜单的响应
|
||||||
type GetUserMenuResponse struct {
|
type GetMenuResponse struct {
|
||||||
state protoimpl.MessageState `protogen:"open.v1"`
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
Data []*MenuItem `protobuf:"bytes,1,rep,name=data,proto3" json:"data,omitempty"`
|
Data []*MenuItem `protobuf:"bytes,1,rep,name=data,proto3" json:"data,omitempty"`
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
sizeCache protoimpl.SizeCache
|
sizeCache protoimpl.SizeCache
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *GetUserMenuResponse) Reset() {
|
func (x *GetMenuResponse) Reset() {
|
||||||
*x = GetUserMenuResponse{}
|
*x = GetMenuResponse{}
|
||||||
mi := &file_organize_proto_msgTypes[11]
|
mi := &file_organize_proto_msgTypes[11]
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
ms.StoreMessageInfo(mi)
|
ms.StoreMessageInfo(mi)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *GetUserMenuResponse) String() string {
|
func (x *GetMenuResponse) String() string {
|
||||||
return protoimpl.X.MessageStringOf(x)
|
return protoimpl.X.MessageStringOf(x)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (*GetUserMenuResponse) ProtoMessage() {}
|
func (*GetMenuResponse) ProtoMessage() {}
|
||||||
|
|
||||||
func (x *GetUserMenuResponse) ProtoReflect() protoreflect.Message {
|
func (x *GetMenuResponse) ProtoReflect() protoreflect.Message {
|
||||||
mi := &file_organize_proto_msgTypes[11]
|
mi := &file_organize_proto_msgTypes[11]
|
||||||
if x != nil {
|
if x != nil {
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
@ -1038,12 +1038,12 @@ func (x *GetUserMenuResponse) ProtoReflect() protoreflect.Message {
|
||||||
return mi.MessageOf(x)
|
return mi.MessageOf(x)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Deprecated: Use GetUserMenuResponse.ProtoReflect.Descriptor instead.
|
// Deprecated: Use GetMenuResponse.ProtoReflect.Descriptor instead.
|
||||||
func (*GetUserMenuResponse) Descriptor() ([]byte, []int) {
|
func (*GetMenuResponse) Descriptor() ([]byte, []int) {
|
||||||
return file_organize_proto_rawDescGZIP(), []int{11}
|
return file_organize_proto_rawDescGZIP(), []int{11}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *GetUserMenuResponse) GetData() []*MenuItem {
|
func (x *GetMenuResponse) GetData() []*MenuItem {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
return x.Data
|
return x.Data
|
||||||
}
|
}
|
||||||
|
@ -2500,162 +2500,6 @@ func (x *GetMenuLevelLabelsResponse) GetData() []*MenuLevelValue {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
type MenuValue struct {
|
|
||||||
state protoimpl.MessageState `protogen:"open.v1"`
|
|
||||||
Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
|
|
||||||
Parent string `protobuf:"bytes,2,opt,name=parent,proto3" json:"parent,omitempty"`
|
|
||||||
Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"`
|
|
||||||
Label string `protobuf:"bytes,4,opt,name=label,proto3" json:"label,omitempty"`
|
|
||||||
Children []*MenuValue `protobuf:"bytes,5,rep,name=children,proto3" json:"children,omitempty"`
|
|
||||||
unknownFields protoimpl.UnknownFields
|
|
||||||
sizeCache protoimpl.SizeCache
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *MenuValue) Reset() {
|
|
||||||
*x = MenuValue{}
|
|
||||||
mi := &file_organize_proto_msgTypes[42]
|
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
|
||||||
ms.StoreMessageInfo(mi)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *MenuValue) String() string {
|
|
||||||
return protoimpl.X.MessageStringOf(x)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (*MenuValue) ProtoMessage() {}
|
|
||||||
|
|
||||||
func (x *MenuValue) ProtoReflect() protoreflect.Message {
|
|
||||||
mi := &file_organize_proto_msgTypes[42]
|
|
||||||
if x != nil {
|
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
|
||||||
if ms.LoadMessageInfo() == nil {
|
|
||||||
ms.StoreMessageInfo(mi)
|
|
||||||
}
|
|
||||||
return ms
|
|
||||||
}
|
|
||||||
return mi.MessageOf(x)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Deprecated: Use MenuValue.ProtoReflect.Descriptor instead.
|
|
||||||
func (*MenuValue) Descriptor() ([]byte, []int) {
|
|
||||||
return file_organize_proto_rawDescGZIP(), []int{42}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *MenuValue) GetId() int64 {
|
|
||||||
if x != nil {
|
|
||||||
return x.Id
|
|
||||||
}
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *MenuValue) GetParent() string {
|
|
||||||
if x != nil {
|
|
||||||
return x.Parent
|
|
||||||
}
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *MenuValue) GetName() string {
|
|
||||||
if x != nil {
|
|
||||||
return x.Name
|
|
||||||
}
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *MenuValue) GetLabel() string {
|
|
||||||
if x != nil {
|
|
||||||
return x.Label
|
|
||||||
}
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *MenuValue) GetChildren() []*MenuValue {
|
|
||||||
if x != nil {
|
|
||||||
return x.Children
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
type GetMenuRequest struct {
|
|
||||||
state protoimpl.MessageState `protogen:"open.v1"`
|
|
||||||
unknownFields protoimpl.UnknownFields
|
|
||||||
sizeCache protoimpl.SizeCache
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *GetMenuRequest) Reset() {
|
|
||||||
*x = GetMenuRequest{}
|
|
||||||
mi := &file_organize_proto_msgTypes[43]
|
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
|
||||||
ms.StoreMessageInfo(mi)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *GetMenuRequest) String() string {
|
|
||||||
return protoimpl.X.MessageStringOf(x)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (*GetMenuRequest) ProtoMessage() {}
|
|
||||||
|
|
||||||
func (x *GetMenuRequest) ProtoReflect() protoreflect.Message {
|
|
||||||
mi := &file_organize_proto_msgTypes[43]
|
|
||||||
if x != nil {
|
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
|
||||||
if ms.LoadMessageInfo() == nil {
|
|
||||||
ms.StoreMessageInfo(mi)
|
|
||||||
}
|
|
||||||
return ms
|
|
||||||
}
|
|
||||||
return mi.MessageOf(x)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Deprecated: Use GetMenuRequest.ProtoReflect.Descriptor instead.
|
|
||||||
func (*GetMenuRequest) Descriptor() ([]byte, []int) {
|
|
||||||
return file_organize_proto_rawDescGZIP(), []int{43}
|
|
||||||
}
|
|
||||||
|
|
||||||
type GetMenuResponse struct {
|
|
||||||
state protoimpl.MessageState `protogen:"open.v1"`
|
|
||||||
Data []*MenuValue `protobuf:"bytes,1,rep,name=data,proto3" json:"data,omitempty"`
|
|
||||||
unknownFields protoimpl.UnknownFields
|
|
||||||
sizeCache protoimpl.SizeCache
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *GetMenuResponse) Reset() {
|
|
||||||
*x = GetMenuResponse{}
|
|
||||||
mi := &file_organize_proto_msgTypes[44]
|
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
|
||||||
ms.StoreMessageInfo(mi)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *GetMenuResponse) String() string {
|
|
||||||
return protoimpl.X.MessageStringOf(x)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (*GetMenuResponse) ProtoMessage() {}
|
|
||||||
|
|
||||||
func (x *GetMenuResponse) ProtoReflect() protoreflect.Message {
|
|
||||||
mi := &file_organize_proto_msgTypes[44]
|
|
||||||
if x != nil {
|
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
|
||||||
if ms.LoadMessageInfo() == nil {
|
|
||||||
ms.StoreMessageInfo(mi)
|
|
||||||
}
|
|
||||||
return ms
|
|
||||||
}
|
|
||||||
return mi.MessageOf(x)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Deprecated: Use GetMenuResponse.ProtoReflect.Descriptor instead.
|
|
||||||
func (*GetMenuResponse) Descriptor() ([]byte, []int) {
|
|
||||||
return file_organize_proto_rawDescGZIP(), []int{44}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *GetMenuResponse) GetData() []*MenuValue {
|
|
||||||
if x != nil {
|
|
||||||
return x.Data
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
type LoginRequest struct {
|
type LoginRequest struct {
|
||||||
state protoimpl.MessageState `protogen:"open.v1"`
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
Username string `protobuf:"bytes,1,opt,name=username,proto3" json:"username,omitempty"`
|
Username string `protobuf:"bytes,1,opt,name=username,proto3" json:"username,omitempty"`
|
||||||
|
@ -2667,7 +2511,7 @@ type LoginRequest struct {
|
||||||
|
|
||||||
func (x *LoginRequest) Reset() {
|
func (x *LoginRequest) Reset() {
|
||||||
*x = LoginRequest{}
|
*x = LoginRequest{}
|
||||||
mi := &file_organize_proto_msgTypes[45]
|
mi := &file_organize_proto_msgTypes[42]
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
ms.StoreMessageInfo(mi)
|
ms.StoreMessageInfo(mi)
|
||||||
}
|
}
|
||||||
|
@ -2679,7 +2523,7 @@ func (x *LoginRequest) String() string {
|
||||||
func (*LoginRequest) ProtoMessage() {}
|
func (*LoginRequest) ProtoMessage() {}
|
||||||
|
|
||||||
func (x *LoginRequest) ProtoReflect() protoreflect.Message {
|
func (x *LoginRequest) ProtoReflect() protoreflect.Message {
|
||||||
mi := &file_organize_proto_msgTypes[45]
|
mi := &file_organize_proto_msgTypes[42]
|
||||||
if x != nil {
|
if x != nil {
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
if ms.LoadMessageInfo() == nil {
|
if ms.LoadMessageInfo() == nil {
|
||||||
|
@ -2692,7 +2536,7 @@ func (x *LoginRequest) ProtoReflect() protoreflect.Message {
|
||||||
|
|
||||||
// Deprecated: Use LoginRequest.ProtoReflect.Descriptor instead.
|
// Deprecated: Use LoginRequest.ProtoReflect.Descriptor instead.
|
||||||
func (*LoginRequest) Descriptor() ([]byte, []int) {
|
func (*LoginRequest) Descriptor() ([]byte, []int) {
|
||||||
return file_organize_proto_rawDescGZIP(), []int{45}
|
return file_organize_proto_rawDescGZIP(), []int{42}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *LoginRequest) GetUsername() string {
|
func (x *LoginRequest) GetUsername() string {
|
||||||
|
@ -2728,7 +2572,7 @@ type LoginResponse struct {
|
||||||
|
|
||||||
func (x *LoginResponse) Reset() {
|
func (x *LoginResponse) Reset() {
|
||||||
*x = LoginResponse{}
|
*x = LoginResponse{}
|
||||||
mi := &file_organize_proto_msgTypes[46]
|
mi := &file_organize_proto_msgTypes[43]
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
ms.StoreMessageInfo(mi)
|
ms.StoreMessageInfo(mi)
|
||||||
}
|
}
|
||||||
|
@ -2740,7 +2584,7 @@ func (x *LoginResponse) String() string {
|
||||||
func (*LoginResponse) ProtoMessage() {}
|
func (*LoginResponse) ProtoMessage() {}
|
||||||
|
|
||||||
func (x *LoginResponse) ProtoReflect() protoreflect.Message {
|
func (x *LoginResponse) ProtoReflect() protoreflect.Message {
|
||||||
mi := &file_organize_proto_msgTypes[46]
|
mi := &file_organize_proto_msgTypes[43]
|
||||||
if x != nil {
|
if x != nil {
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
if ms.LoadMessageInfo() == nil {
|
if ms.LoadMessageInfo() == nil {
|
||||||
|
@ -2753,7 +2597,7 @@ func (x *LoginResponse) ProtoReflect() protoreflect.Message {
|
||||||
|
|
||||||
// Deprecated: Use LoginResponse.ProtoReflect.Descriptor instead.
|
// Deprecated: Use LoginResponse.ProtoReflect.Descriptor instead.
|
||||||
func (*LoginResponse) Descriptor() ([]byte, []int) {
|
func (*LoginResponse) Descriptor() ([]byte, []int) {
|
||||||
return file_organize_proto_rawDescGZIP(), []int{46}
|
return file_organize_proto_rawDescGZIP(), []int{43}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *LoginResponse) GetUid() string {
|
func (x *LoginResponse) GetUid() string {
|
||||||
|
@ -2793,7 +2637,7 @@ type LogoutRequest struct {
|
||||||
|
|
||||||
func (x *LogoutRequest) Reset() {
|
func (x *LogoutRequest) Reset() {
|
||||||
*x = LogoutRequest{}
|
*x = LogoutRequest{}
|
||||||
mi := &file_organize_proto_msgTypes[47]
|
mi := &file_organize_proto_msgTypes[44]
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
ms.StoreMessageInfo(mi)
|
ms.StoreMessageInfo(mi)
|
||||||
}
|
}
|
||||||
|
@ -2805,7 +2649,7 @@ func (x *LogoutRequest) String() string {
|
||||||
func (*LogoutRequest) ProtoMessage() {}
|
func (*LogoutRequest) ProtoMessage() {}
|
||||||
|
|
||||||
func (x *LogoutRequest) ProtoReflect() protoreflect.Message {
|
func (x *LogoutRequest) ProtoReflect() protoreflect.Message {
|
||||||
mi := &file_organize_proto_msgTypes[47]
|
mi := &file_organize_proto_msgTypes[44]
|
||||||
if x != nil {
|
if x != nil {
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
if ms.LoadMessageInfo() == nil {
|
if ms.LoadMessageInfo() == nil {
|
||||||
|
@ -2818,7 +2662,7 @@ func (x *LogoutRequest) ProtoReflect() protoreflect.Message {
|
||||||
|
|
||||||
// Deprecated: Use LogoutRequest.ProtoReflect.Descriptor instead.
|
// Deprecated: Use LogoutRequest.ProtoReflect.Descriptor instead.
|
||||||
func (*LogoutRequest) Descriptor() ([]byte, []int) {
|
func (*LogoutRequest) Descriptor() ([]byte, []int) {
|
||||||
return file_organize_proto_rawDescGZIP(), []int{47}
|
return file_organize_proto_rawDescGZIP(), []int{44}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *LogoutRequest) GetToken() string {
|
func (x *LogoutRequest) GetToken() string {
|
||||||
|
@ -2837,7 +2681,7 @@ type LogoutResponse struct {
|
||||||
|
|
||||||
func (x *LogoutResponse) Reset() {
|
func (x *LogoutResponse) Reset() {
|
||||||
*x = LogoutResponse{}
|
*x = LogoutResponse{}
|
||||||
mi := &file_organize_proto_msgTypes[48]
|
mi := &file_organize_proto_msgTypes[45]
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
ms.StoreMessageInfo(mi)
|
ms.StoreMessageInfo(mi)
|
||||||
}
|
}
|
||||||
|
@ -2849,7 +2693,7 @@ func (x *LogoutResponse) String() string {
|
||||||
func (*LogoutResponse) ProtoMessage() {}
|
func (*LogoutResponse) ProtoMessage() {}
|
||||||
|
|
||||||
func (x *LogoutResponse) ProtoReflect() protoreflect.Message {
|
func (x *LogoutResponse) ProtoReflect() protoreflect.Message {
|
||||||
mi := &file_organize_proto_msgTypes[48]
|
mi := &file_organize_proto_msgTypes[45]
|
||||||
if x != nil {
|
if x != nil {
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
if ms.LoadMessageInfo() == nil {
|
if ms.LoadMessageInfo() == nil {
|
||||||
|
@ -2862,7 +2706,7 @@ func (x *LogoutResponse) ProtoReflect() protoreflect.Message {
|
||||||
|
|
||||||
// Deprecated: Use LogoutResponse.ProtoReflect.Descriptor instead.
|
// Deprecated: Use LogoutResponse.ProtoReflect.Descriptor instead.
|
||||||
func (*LogoutResponse) Descriptor() ([]byte, []int) {
|
func (*LogoutResponse) Descriptor() ([]byte, []int) {
|
||||||
return file_organize_proto_rawDescGZIP(), []int{48}
|
return file_organize_proto_rawDescGZIP(), []int{45}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *LogoutResponse) GetUid() string {
|
func (x *LogoutResponse) GetUid() string {
|
||||||
|
@ -2876,7 +2720,7 @@ var File_organize_proto protoreflect.FileDescriptor
|
||||||
|
|
||||||
const file_organize_proto_rawDesc = "" +
|
const file_organize_proto_rawDesc = "" +
|
||||||
"\n" +
|
"\n" +
|
||||||
"\x0eorganize.proto\x12\borganize\x1a\x0faeus/rest.proto\x1a\x17validate/validate.proto\x1a google/protobuf/descriptor.proto\x1a\x1cgoogle/api/annotations.proto\"\xc2\b\n" +
|
"\x0eorganize.proto\x12\borganize\x1a\x0faeus/rest.proto\x1a\x17validate/validate.proto\x1a google/protobuf/descriptor.proto\x1a\x1cgoogle/api/annotations.proto\"\xab\b\n" +
|
||||||
"\x04Menu\x12*\n" +
|
"\x04Menu\x12*\n" +
|
||||||
"\x02id\x18\x01 \x01(\x03B\x1a\xb2\xb9\x19\x16\n" +
|
"\x02id\x18\x01 \x01(\x03B\x1a\xb2\xb9\x19\x16\n" +
|
||||||
"\n" +
|
"\n" +
|
||||||
|
@ -2885,9 +2729,9 @@ const file_organize_proto_rawDesc = "" +
|
||||||
"created_at\x18\x02 \x01(\x03B\x1f\xb2\xb9\x19\x1b\x12\f创建时间\x1a\vview;exportR\tcreatedAt\x12E\n" +
|
"created_at\x18\x02 \x01(\x03B\x1f\xb2\xb9\x19\x1b\x12\f创建时间\x1a\vview;exportR\tcreatedAt\x12E\n" +
|
||||||
"\n" +
|
"\n" +
|
||||||
"updated_at\x18\x03 \x01(\x03B&\xb2\xb9\x19\"\n" +
|
"updated_at\x18\x03 \x01(\x03B&\xb2\xb9\x19\"\n" +
|
||||||
"\x05index\x12\f更新时间\x1a\vview;exportR\tupdatedAt\x12\x91\x01\n" +
|
"\x05index\x12\f更新时间\x1a\vview;exportR\tupdatedAt\x12v\n" +
|
||||||
"\x06parent\x18\x04 \x01(\tBy\xb2\xb9\x19u\n" +
|
"\x06parent\x18\x04 \x01(\tB^\xb2\xb9\x19Z\n" +
|
||||||
"\rindex;size:60\x12\f父级菜单\x1a\x19create;update;view;export*\x04menu2\x0freadonly:updateB$type:dropdown;url:/menu/level-labelsR\x06parent\x12^\n" +
|
"\rindex;size:60\x12\f父级菜单*\x04menu2\x0freadonly:updateB$type:dropdown;url:/menu/level-labelsR\x06parent\x12^\n" +
|
||||||
"\x04name\x18\x05 \x01(\tBJ\xfaB\x04r\x02\x18<\xb2\xb9\x19?\n" +
|
"\x04name\x18\x05 \x01(\tBJ\xfaB\x04r\x02\x18<\xb2\xb9\x19?\n" +
|
||||||
"\rindex;size:60\x12\f组件名称2\x0freadonly:update:\x0funique;requiredR\x04name\x12C\n" +
|
"\rindex;size:60\x12\f组件名称2\x0freadonly:update:\x0funique;requiredR\x04name\x12C\n" +
|
||||||
"\x05label\x18\x06 \x01(\tB-\xfaB\x04r\x02\x18x\xb2\xb9\x19\"\n" +
|
"\x05label\x18\x06 \x01(\tB-\xfaB\x04r\x02\x18x\xb2\xb9\x19\"\n" +
|
||||||
|
@ -2900,11 +2744,11 @@ const file_organize_proto_rawDesc = "" +
|
||||||
"\asize:60\x12\f菜单图标\x1a\x19create;update;view;exportR\x04icon\x12E\n" +
|
"\asize:60\x12\f菜单图标\x1a\x19create;update;view;exportR\x04icon\x12E\n" +
|
||||||
"\x06hidden\x18\n" +
|
"\x06hidden\x18\n" +
|
||||||
" \x01(\bB-\xb2\xb9\x19)\x12\f是否隐藏\x1a\x19create;update;view;exportR\x06hidden\x12E\n" +
|
" \x01(\bB-\xb2\xb9\x19)\x12\f是否隐藏\x1a\x19create;update;view;exportR\x06hidden\x12E\n" +
|
||||||
"\x06public\x18\v \x01(\bB-\xb2\xb9\x19)\x12\f是否公开\x1a\x19create;update;view;exportR\x06public\x12l\n" +
|
"\x06public\x18\v \x01(\bB-\xb2\xb9\x19)\x12\f是否公开\x1a\x19create;update;view;exportR\x06public\x12q\n" +
|
||||||
"\vdescription\x18\f \x01(\tBJ\xfaB\x05r\x03\x18\x80\b\xb2\xb9\x19>\n" +
|
"\vdescription\x18\f \x01(\tBO\xfaB\x05r\x03\x18\x80\b\xb2\xb9\x19C\n" +
|
||||||
"\tsize:1024\x12\f备注说明\x1a\x19create;update;view;export*\btextareaR\vdescription\x127\n" +
|
"\tsize:1024\x12\f备注说明\x1a\x1ecreate;update;view;export;list*\btextareaR\vdescription\x127\n" +
|
||||||
"\bposition\x18\r \x01(\x03B\x1b\xb2\xb9\x19\x17\x12\x06排序\x1a\rcreate;updateR\bposition:\v\xba\xb9\x19\a\n" +
|
"\bposition\x18\r \x01(\x03B\x1b\xb2\xb9\x19\x17\x12\x06排序\x1a\rcreate;updateR\bposition:\v\xba\xb9\x19\a\n" +
|
||||||
"\x05menus\"\xd1\x03\n" +
|
"\x05menus\"\xbd\x03\n" +
|
||||||
"\x04Role\x12*\n" +
|
"\x04Role\x12*\n" +
|
||||||
"\x02id\x18\x01 \x01(\x03B\x1a\xb2\xb9\x19\x16\n" +
|
"\x02id\x18\x01 \x01(\x03B\x1a\xb2\xb9\x19\x16\n" +
|
||||||
"\n" +
|
"\n" +
|
||||||
|
@ -2913,11 +2757,11 @@ const file_organize_proto_rawDesc = "" +
|
||||||
"created_at\x18\x02 \x01(\x03B\x1f\xb2\xb9\x19\x1b\x12\f创建时间\x1a\vview;exportR\tcreatedAt\x12E\n" +
|
"created_at\x18\x02 \x01(\x03B\x1f\xb2\xb9\x19\x1b\x12\f创建时间\x1a\vview;exportR\tcreatedAt\x12E\n" +
|
||||||
"\n" +
|
"\n" +
|
||||||
"updated_at\x18\x03 \x01(\x03B&\xb2\xb9\x19\"\n" +
|
"updated_at\x18\x03 \x01(\x03B&\xb2\xb9\x19\"\n" +
|
||||||
"\x05index\x12\f更新时间\x1a\vview;exportR\tupdatedAt\x12W\n" +
|
"\x05index\x12\f更新时间\x1a\vview;exportR\tupdatedAt\x12M\n" +
|
||||||
"\x04name\x18\x04 \x01(\tBC\xfaB\x04r\x02\x18<\xb2\xb9\x198\n" +
|
"\x04name\x18\x04 \x01(\tB9\xfaB\x04r\x02\x18<\xb2\xb9\x19.\n" +
|
||||||
"\rindex;size:60\x12\f角色名称2\x0freadonly:update:\brequiredR\x04name\x12B\n" +
|
"\rindex;size:60\x12\f角色名称2\x0freadonly:updateR\x04name\x128\n" +
|
||||||
"\x05label\x18\x05 \x01(\tB,\xfaB\x04r\x02\x18<\xb2\xb9\x19!\n" +
|
"\x05label\x18\x05 \x01(\tB\"\xfaB\x04r\x02\x18<\xb2\xb9\x19\x17\n" +
|
||||||
"\asize:60\x12\f角色标题:\brequiredR\x05label\x12l\n" +
|
"\asize:60\x12\f角色标题R\x05label\x12l\n" +
|
||||||
"\vdescription\x18\x06 \x01(\tBJ\xfaB\x05r\x03\x18\x80\b\xb2\xb9\x19>\n" +
|
"\vdescription\x18\x06 \x01(\tBJ\xfaB\x05r\x03\x18\x80\b\xb2\xb9\x19>\n" +
|
||||||
"\tsize:1024\x12\f备注说明\x1a\x19list;create;update;export*\btextareaR\vdescription:\v\xba\xb9\x19\a\n" +
|
"\tsize:1024\x12\f备注说明\x1a\x19list;create;update;export*\btextareaR\vdescription:\v\xba\xb9\x19\a\n" +
|
||||||
"\x05roles\"\xb1\x03\n" +
|
"\x05roles\"\xb1\x03\n" +
|
||||||
|
@ -3042,12 +2886,12 @@ const file_organize_proto_rawDesc = "" +
|
||||||
"\x05route\x18\x06 \x01(\tR\x05route\x12\x12\n" +
|
"\x05route\x18\x06 \x01(\tR\x05route\x12\x12\n" +
|
||||||
"\x04view\x18\a \x01(\tR\x04view\x12:\n" +
|
"\x04view\x18\a \x01(\tR\x04view\x12:\n" +
|
||||||
"\vpermissions\x18\b \x03(\v2\x18.organize.PermissionItemR\vpermissions\x12.\n" +
|
"\vpermissions\x18\b \x03(\v2\x18.organize.PermissionItemR\vpermissions\x12.\n" +
|
||||||
"\bchildren\x18\t \x03(\v2\x12.organize.MenuItemR\bchildren\"4\n" +
|
"\bchildren\x18\t \x03(\v2\x12.organize.MenuItemR\bchildren\"0\n" +
|
||||||
"\x12GetUserMenuRequest\x12\x1e\n" +
|
"\x0eGetMenuRequest\x12\x1e\n" +
|
||||||
"\n" +
|
"\n" +
|
||||||
"permission\x18\x01 \x01(\bR\n" +
|
"permission\x18\x01 \x01(\bR\n" +
|
||||||
"permission\"=\n" +
|
"permission\"9\n" +
|
||||||
"\x13GetUserMenuResponse\x12&\n" +
|
"\x0fGetMenuResponse\x12&\n" +
|
||||||
"\x04data\x18\x01 \x03(\v2\x12.organize.MenuItemR\x04data\"%\n" +
|
"\x04data\x18\x01 \x03(\v2\x12.organize.MenuItemR\x04data\"%\n" +
|
||||||
"\x11GetProfileRequest\x12\x10\n" +
|
"\x11GetProfileRequest\x12\x10\n" +
|
||||||
"\x03uid\x18\x01 \x01(\tR\x03uid\"\xbc\x01\n" +
|
"\x03uid\x18\x01 \x01(\tR\x03uid\"\xbc\x01\n" +
|
||||||
|
@ -3124,16 +2968,7 @@ const file_organize_proto_rawDesc = "" +
|
||||||
"\bchildren\x18\x04 \x03(\v2\x18.organize.MenuLevelValueR\bchildren\"\x1b\n" +
|
"\bchildren\x18\x04 \x03(\v2\x18.organize.MenuLevelValueR\bchildren\"\x1b\n" +
|
||||||
"\x19GetMenuLevelLabelsRequest\"J\n" +
|
"\x19GetMenuLevelLabelsRequest\"J\n" +
|
||||||
"\x1aGetMenuLevelLabelsResponse\x12,\n" +
|
"\x1aGetMenuLevelLabelsResponse\x12,\n" +
|
||||||
"\x04data\x18\x01 \x03(\v2\x18.organize.MenuLevelValueR\x04data\"\x8e\x01\n" +
|
"\x04data\x18\x01 \x03(\v2\x18.organize.MenuLevelValueR\x04data\"\\\n" +
|
||||||
"\tMenuValue\x12\x0e\n" +
|
|
||||||
"\x02id\x18\x01 \x01(\x03R\x02id\x12\x16\n" +
|
|
||||||
"\x06parent\x18\x02 \x01(\tR\x06parent\x12\x12\n" +
|
|
||||||
"\x04name\x18\x03 \x01(\tR\x04name\x12\x14\n" +
|
|
||||||
"\x05label\x18\x04 \x01(\tR\x05label\x12/\n" +
|
|
||||||
"\bchildren\x18\x05 \x03(\v2\x13.organize.MenuValueR\bchildren\"\x10\n" +
|
|
||||||
"\x0eGetMenuRequest\":\n" +
|
|
||||||
"\x0fGetMenuResponse\x12'\n" +
|
|
||||||
"\x04data\x18\x01 \x03(\v2\x13.organize.MenuValueR\x04data\"\\\n" +
|
|
||||||
"\fLoginRequest\x12\x1a\n" +
|
"\fLoginRequest\x12\x1a\n" +
|
||||||
"\busername\x18\x01 \x01(\tR\busername\x12\x1a\n" +
|
"\busername\x18\x01 \x01(\tR\busername\x12\x1a\n" +
|
||||||
"\bpassword\x18\x02 \x01(\tR\bpassword\x12\x14\n" +
|
"\bpassword\x18\x02 \x01(\tR\bpassword\x12\x14\n" +
|
||||||
|
@ -3146,9 +2981,9 @@ const file_organize_proto_rawDesc = "" +
|
||||||
"\rLogoutRequest\x12\x14\n" +
|
"\rLogoutRequest\x12\x14\n" +
|
||||||
"\x05token\x18\x01 \x01(\tR\x05token\"\"\n" +
|
"\x05token\x18\x01 \x01(\tR\x05token\"\"\n" +
|
||||||
"\x0eLogoutResponse\x12\x10\n" +
|
"\x0eLogoutResponse\x12\x10\n" +
|
||||||
"\x03uid\x18\x01 \x01(\tR\x03uid2\xdc\x05\n" +
|
"\x03uid\x18\x01 \x01(\tR\x03uid2\xd4\x05\n" +
|
||||||
"\vUserService\x12\\\n" +
|
"\vUserService\x12T\n" +
|
||||||
"\bGetMenus\x12\x1c.organize.GetUserMenuRequest\x1a\x1d.organize.GetUserMenuResponse\"\x13\x82\xd3\xe4\x93\x02\r\x12\v/user/menus\x12^\n" +
|
"\bGetMenus\x12\x18.organize.GetMenuRequest\x1a\x19.organize.GetMenuResponse\"\x13\x82\xd3\xe4\x93\x02\r\x12\v/user/menus\x12^\n" +
|
||||||
"\n" +
|
"\n" +
|
||||||
"GetProfile\x12\x1b.organize.GetProfileRequest\x1a\x1c.organize.GetProfileResponse\"\x15\x82\xd3\xe4\x93\x02\x0f\x12\r/user/profile\x12j\n" +
|
"GetProfile\x12\x1b.organize.GetProfileRequest\x1a\x1c.organize.GetProfileResponse\"\x15\x82\xd3\xe4\x93\x02\x0f\x12\r/user/profile\x12j\n" +
|
||||||
"\rUpdateProfile\x12\x1e.organize.UpdateProfileRequest\x1a\x1f.organize.UpdateProfileResponse\"\x18\x82\xd3\xe4\x93\x02\x12:\x01*\x1a\r/user/profile\x12q\n" +
|
"\rUpdateProfile\x12\x1e.organize.UpdateProfileRequest\x1a\x1f.organize.UpdateProfileResponse\"\x18\x82\xd3\xe4\x93\x02\x12:\x01*\x1a\r/user/profile\x12q\n" +
|
||||||
|
@ -3164,10 +2999,8 @@ const file_organize_proto_rawDesc = "" +
|
||||||
"\vRoleService\x12d\n" +
|
"\vRoleService\x12d\n" +
|
||||||
"\rGetRoleLabels\x12\x1d.organize.GetRoleLabelRequest\x1a\x1e.organize.GetRoleLabelResponse\"\x14\x82\xd3\xe4\x93\x02\x0e\x12\f/role/labels\x12x\n" +
|
"\rGetRoleLabels\x12\x1d.organize.GetRoleLabelRequest\x1a\x1e.organize.GetRoleLabelResponse\"\x14\x82\xd3\xe4\x93\x02\x0e\x12\f/role/labels\x12x\n" +
|
||||||
"\x12GetRolePermissions\x12\".organize.GetRolePermissionRequest\x1a#.organize.GetRolePermissionResponse\"\x19\x82\xd3\xe4\x93\x02\x13\x12\x11/role/permissions\x12}\n" +
|
"\x12GetRolePermissions\x12\".organize.GetRolePermissionRequest\x1a#.organize.GetRolePermissionResponse\"\x19\x82\xd3\xe4\x93\x02\x13\x12\x11/role/permissions\x12}\n" +
|
||||||
"\x12SaveRolePermission\x12#.organize.SaveRolePermissionRequest\x1a$.organize.SaveRolePermissionResponse\"\x1c\x82\xd3\xe4\x93\x02\x16:\x01*\"\x11/role/permissions2\xdf\x01\n" +
|
"\x12SaveRolePermission\x12#.organize.SaveRolePermissionRequest\x1a$.organize.SaveRolePermissionResponse\"\x1c\x82\xd3\xe4\x93\x02\x16:\x01*\"\x11/role/permissions2\x8a\x01\n" +
|
||||||
"\vMenuService\x12S\n" +
|
"\vMenuService\x12{\n" +
|
||||||
"\bGetMenus\x12\x18.organize.GetMenuRequest\x1a\x19.organize.GetMenuResponse\"\x12\x82\xd3\xe4\x93\x02\f\x12\n" +
|
|
||||||
"/menu/list\x12{\n" +
|
|
||||||
"\x12GetMenuLevelLabels\x12#.organize.GetMenuLevelLabelsRequest\x1a$.organize.GetMenuLevelLabelsResponse\"\x1a\x82\xd3\xe4\x93\x02\x14\x12\x12/menu/level-labels2\xbd\x01\n" +
|
"\x12GetMenuLevelLabels\x12#.organize.GetMenuLevelLabelsRequest\x1a$.organize.GetMenuLevelLabelsResponse\"\x1a\x82\xd3\xe4\x93\x02\x14\x12\x12/menu/level-labels2\xbd\x01\n" +
|
||||||
"\vAuthService\x12T\n" +
|
"\vAuthService\x12T\n" +
|
||||||
"\x05Login\x12\x16.organize.LoginRequest\x1a\x17.organize.LoginResponse\"\x1a\x82\xd3\xe4\x93\x02\x14:\x01*\"\x0f/passport/login\x12X\n" +
|
"\x05Login\x12\x16.organize.LoginRequest\x1a\x17.organize.LoginResponse\"\x1a\x82\xd3\xe4\x93\x02\x14:\x01*\"\x0f/passport/login\x12X\n" +
|
||||||
|
@ -3185,7 +3018,7 @@ func file_organize_proto_rawDescGZIP() []byte {
|
||||||
return file_organize_proto_rawDescData
|
return file_organize_proto_rawDescData
|
||||||
}
|
}
|
||||||
|
|
||||||
var file_organize_proto_msgTypes = make([]protoimpl.MessageInfo, 49)
|
var file_organize_proto_msgTypes = make([]protoimpl.MessageInfo, 46)
|
||||||
var file_organize_proto_goTypes = []any{
|
var file_organize_proto_goTypes = []any{
|
||||||
(*Menu)(nil), // 0: organize.Menu
|
(*Menu)(nil), // 0: organize.Menu
|
||||||
(*Role)(nil), // 1: organize.Role
|
(*Role)(nil), // 1: organize.Role
|
||||||
|
@ -3197,8 +3030,8 @@ var file_organize_proto_goTypes = []any{
|
||||||
(*LabelValue)(nil), // 7: organize.LabelValue
|
(*LabelValue)(nil), // 7: organize.LabelValue
|
||||||
(*PermissionItem)(nil), // 8: organize.PermissionItem
|
(*PermissionItem)(nil), // 8: organize.PermissionItem
|
||||||
(*MenuItem)(nil), // 9: organize.MenuItem
|
(*MenuItem)(nil), // 9: organize.MenuItem
|
||||||
(*GetUserMenuRequest)(nil), // 10: organize.GetUserMenuRequest
|
(*GetMenuRequest)(nil), // 10: organize.GetMenuRequest
|
||||||
(*GetUserMenuResponse)(nil), // 11: organize.GetUserMenuResponse
|
(*GetMenuResponse)(nil), // 11: organize.GetMenuResponse
|
||||||
(*GetProfileRequest)(nil), // 12: organize.GetProfileRequest
|
(*GetProfileRequest)(nil), // 12: organize.GetProfileRequest
|
||||||
(*GetProfileResponse)(nil), // 13: organize.GetProfileResponse
|
(*GetProfileResponse)(nil), // 13: organize.GetProfileResponse
|
||||||
(*ResetPasswordRequest)(nil), // 14: organize.ResetPasswordRequest
|
(*ResetPasswordRequest)(nil), // 14: organize.ResetPasswordRequest
|
||||||
|
@ -3229,18 +3062,15 @@ var file_organize_proto_goTypes = []any{
|
||||||
(*MenuLevelValue)(nil), // 39: organize.MenuLevelValue
|
(*MenuLevelValue)(nil), // 39: organize.MenuLevelValue
|
||||||
(*GetMenuLevelLabelsRequest)(nil), // 40: organize.GetMenuLevelLabelsRequest
|
(*GetMenuLevelLabelsRequest)(nil), // 40: organize.GetMenuLevelLabelsRequest
|
||||||
(*GetMenuLevelLabelsResponse)(nil), // 41: organize.GetMenuLevelLabelsResponse
|
(*GetMenuLevelLabelsResponse)(nil), // 41: organize.GetMenuLevelLabelsResponse
|
||||||
(*MenuValue)(nil), // 42: organize.MenuValue
|
(*LoginRequest)(nil), // 42: organize.LoginRequest
|
||||||
(*GetMenuRequest)(nil), // 43: organize.GetMenuRequest
|
(*LoginResponse)(nil), // 43: organize.LoginResponse
|
||||||
(*GetMenuResponse)(nil), // 44: organize.GetMenuResponse
|
(*LogoutRequest)(nil), // 44: organize.LogoutRequest
|
||||||
(*LoginRequest)(nil), // 45: organize.LoginRequest
|
(*LogoutResponse)(nil), // 45: organize.LogoutResponse
|
||||||
(*LoginResponse)(nil), // 46: organize.LoginResponse
|
|
||||||
(*LogoutRequest)(nil), // 47: organize.LogoutRequest
|
|
||||||
(*LogoutResponse)(nil), // 48: organize.LogoutResponse
|
|
||||||
}
|
}
|
||||||
var file_organize_proto_depIdxs = []int32{
|
var file_organize_proto_depIdxs = []int32{
|
||||||
8, // 0: organize.MenuItem.permissions:type_name -> organize.PermissionItem
|
8, // 0: organize.MenuItem.permissions:type_name -> organize.PermissionItem
|
||||||
9, // 1: organize.MenuItem.children:type_name -> organize.MenuItem
|
9, // 1: organize.MenuItem.children:type_name -> organize.MenuItem
|
||||||
9, // 2: organize.GetUserMenuResponse.data:type_name -> organize.MenuItem
|
9, // 2: organize.GetMenuResponse.data:type_name -> organize.MenuItem
|
||||||
7, // 3: organize.GetUserLabelResponse.data:type_name -> organize.LabelValue
|
7, // 3: organize.GetUserLabelResponse.data:type_name -> organize.LabelValue
|
||||||
7, // 4: organize.GetUserTagResponse.data:type_name -> organize.LabelValue
|
7, // 4: organize.GetUserTagResponse.data:type_name -> organize.LabelValue
|
||||||
25, // 5: organize.DepartmentUserValue.children:type_name -> organize.DepartmentUserValue
|
25, // 5: organize.DepartmentUserValue.children:type_name -> organize.DepartmentUserValue
|
||||||
|
@ -3251,47 +3081,43 @@ var file_organize_proto_depIdxs = []int32{
|
||||||
7, // 10: organize.GetRoleLabelResponse.data:type_name -> organize.LabelValue
|
7, // 10: organize.GetRoleLabelResponse.data:type_name -> organize.LabelValue
|
||||||
39, // 11: organize.MenuLevelValue.children:type_name -> organize.MenuLevelValue
|
39, // 11: organize.MenuLevelValue.children:type_name -> organize.MenuLevelValue
|
||||||
39, // 12: organize.GetMenuLevelLabelsResponse.data:type_name -> organize.MenuLevelValue
|
39, // 12: organize.GetMenuLevelLabelsResponse.data:type_name -> organize.MenuLevelValue
|
||||||
42, // 13: organize.MenuValue.children:type_name -> organize.MenuValue
|
10, // 13: organize.UserService.GetMenus:input_type -> organize.GetMenuRequest
|
||||||
42, // 14: organize.GetMenuResponse.data:type_name -> organize.MenuValue
|
12, // 14: organize.UserService.GetProfile:input_type -> organize.GetProfileRequest
|
||||||
10, // 15: organize.UserService.GetMenus:input_type -> organize.GetUserMenuRequest
|
16, // 15: organize.UserService.UpdateProfile:input_type -> organize.UpdateProfileRequest
|
||||||
12, // 16: organize.UserService.GetProfile:input_type -> organize.GetProfileRequest
|
14, // 16: organize.UserService.ResetPassword:input_type -> organize.ResetPasswordRequest
|
||||||
16, // 17: organize.UserService.UpdateProfile:input_type -> organize.UpdateProfileRequest
|
18, // 17: organize.UserService.GetPermissions:input_type -> organize.GetPermissionRequest
|
||||||
14, // 18: organize.UserService.ResetPassword:input_type -> organize.ResetPasswordRequest
|
20, // 18: organize.UserService.GetUserLabels:input_type -> organize.GetUserLabelRequest
|
||||||
18, // 19: organize.UserService.GetPermissions:input_type -> organize.GetPermissionRequest
|
22, // 19: organize.UserService.GetUserTags:input_type -> organize.GetUserTagRequest
|
||||||
20, // 20: organize.UserService.GetUserLabels:input_type -> organize.GetUserLabelRequest
|
26, // 20: organize.DepartmentService.GetDepartmentLabels:input_type -> organize.GetDepartmentLabelRequest
|
||||||
22, // 21: organize.UserService.GetUserTags:input_type -> organize.GetUserTagRequest
|
28, // 21: organize.DepartmentService.GetDepartmentUsers:input_type -> organize.GetDepartmentUserRequest
|
||||||
26, // 22: organize.DepartmentService.GetDepartmentLabels:input_type -> organize.GetDepartmentLabelRequest
|
31, // 22: organize.DepartmentService.GetDepartmentLevelLabels:input_type -> organize.GetDepartmentLevelLabelsRequest
|
||||||
28, // 23: organize.DepartmentService.GetDepartmentUsers:input_type -> organize.GetDepartmentUserRequest
|
33, // 23: organize.RoleService.GetRoleLabels:input_type -> organize.GetRoleLabelRequest
|
||||||
31, // 24: organize.DepartmentService.GetDepartmentLevelLabels:input_type -> organize.GetDepartmentLevelLabelsRequest
|
35, // 24: organize.RoleService.GetRolePermissions:input_type -> organize.GetRolePermissionRequest
|
||||||
33, // 25: organize.RoleService.GetRoleLabels:input_type -> organize.GetRoleLabelRequest
|
37, // 25: organize.RoleService.SaveRolePermission:input_type -> organize.SaveRolePermissionRequest
|
||||||
35, // 26: organize.RoleService.GetRolePermissions:input_type -> organize.GetRolePermissionRequest
|
40, // 26: organize.MenuService.GetMenuLevelLabels:input_type -> organize.GetMenuLevelLabelsRequest
|
||||||
37, // 27: organize.RoleService.SaveRolePermission:input_type -> organize.SaveRolePermissionRequest
|
42, // 27: organize.AuthService.Login:input_type -> organize.LoginRequest
|
||||||
43, // 28: organize.MenuService.GetMenus:input_type -> organize.GetMenuRequest
|
44, // 28: organize.AuthService.Logout:input_type -> organize.LogoutRequest
|
||||||
40, // 29: organize.MenuService.GetMenuLevelLabels:input_type -> organize.GetMenuLevelLabelsRequest
|
11, // 29: organize.UserService.GetMenus:output_type -> organize.GetMenuResponse
|
||||||
45, // 30: organize.AuthService.Login:input_type -> organize.LoginRequest
|
13, // 30: organize.UserService.GetProfile:output_type -> organize.GetProfileResponse
|
||||||
47, // 31: organize.AuthService.Logout:input_type -> organize.LogoutRequest
|
17, // 31: organize.UserService.UpdateProfile:output_type -> organize.UpdateProfileResponse
|
||||||
11, // 32: organize.UserService.GetMenus:output_type -> organize.GetUserMenuResponse
|
15, // 32: organize.UserService.ResetPassword:output_type -> organize.ResetPasswordResponse
|
||||||
13, // 33: organize.UserService.GetProfile:output_type -> organize.GetProfileResponse
|
19, // 33: organize.UserService.GetPermissions:output_type -> organize.GetPermissionResponse
|
||||||
17, // 34: organize.UserService.UpdateProfile:output_type -> organize.UpdateProfileResponse
|
21, // 34: organize.UserService.GetUserLabels:output_type -> organize.GetUserLabelResponse
|
||||||
15, // 35: organize.UserService.ResetPassword:output_type -> organize.ResetPasswordResponse
|
23, // 35: organize.UserService.GetUserTags:output_type -> organize.GetUserTagResponse
|
||||||
19, // 36: organize.UserService.GetPermissions:output_type -> organize.GetPermissionResponse
|
27, // 36: organize.DepartmentService.GetDepartmentLabels:output_type -> organize.GetDepartmentLabelResponse
|
||||||
21, // 37: organize.UserService.GetUserLabels:output_type -> organize.GetUserLabelResponse
|
29, // 37: organize.DepartmentService.GetDepartmentUsers:output_type -> organize.GetDepartmentUserResponse
|
||||||
23, // 38: organize.UserService.GetUserTags:output_type -> organize.GetUserTagResponse
|
32, // 38: organize.DepartmentService.GetDepartmentLevelLabels:output_type -> organize.GetDepartmentLevelLabelsResponse
|
||||||
27, // 39: organize.DepartmentService.GetDepartmentLabels:output_type -> organize.GetDepartmentLabelResponse
|
34, // 39: organize.RoleService.GetRoleLabels:output_type -> organize.GetRoleLabelResponse
|
||||||
29, // 40: organize.DepartmentService.GetDepartmentUsers:output_type -> organize.GetDepartmentUserResponse
|
36, // 40: organize.RoleService.GetRolePermissions:output_type -> organize.GetRolePermissionResponse
|
||||||
32, // 41: organize.DepartmentService.GetDepartmentLevelLabels:output_type -> organize.GetDepartmentLevelLabelsResponse
|
38, // 41: organize.RoleService.SaveRolePermission:output_type -> organize.SaveRolePermissionResponse
|
||||||
34, // 42: organize.RoleService.GetRoleLabels:output_type -> organize.GetRoleLabelResponse
|
41, // 42: organize.MenuService.GetMenuLevelLabels:output_type -> organize.GetMenuLevelLabelsResponse
|
||||||
36, // 43: organize.RoleService.GetRolePermissions:output_type -> organize.GetRolePermissionResponse
|
43, // 43: organize.AuthService.Login:output_type -> organize.LoginResponse
|
||||||
38, // 44: organize.RoleService.SaveRolePermission:output_type -> organize.SaveRolePermissionResponse
|
45, // 44: organize.AuthService.Logout:output_type -> organize.LogoutResponse
|
||||||
44, // 45: organize.MenuService.GetMenus:output_type -> organize.GetMenuResponse
|
29, // [29:45] is the sub-list for method output_type
|
||||||
41, // 46: organize.MenuService.GetMenuLevelLabels:output_type -> organize.GetMenuLevelLabelsResponse
|
13, // [13:29] is the sub-list for method input_type
|
||||||
46, // 47: organize.AuthService.Login:output_type -> organize.LoginResponse
|
13, // [13:13] is the sub-list for extension type_name
|
||||||
48, // 48: organize.AuthService.Logout:output_type -> organize.LogoutResponse
|
13, // [13:13] is the sub-list for extension extendee
|
||||||
32, // [32:49] is the sub-list for method output_type
|
0, // [0:13] is the sub-list for field type_name
|
||||||
15, // [15:32] is the sub-list for method input_type
|
|
||||||
15, // [15:15] is the sub-list for extension type_name
|
|
||||||
15, // [15:15] is the sub-list for extension extendee
|
|
||||||
0, // [0:15] is the sub-list for field type_name
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() { file_organize_proto_init() }
|
func init() { file_organize_proto_init() }
|
||||||
|
@ -3305,7 +3131,7 @@ func file_organize_proto_init() {
|
||||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||||
RawDescriptor: unsafe.Slice(unsafe.StringData(file_organize_proto_rawDesc), len(file_organize_proto_rawDesc)),
|
RawDescriptor: unsafe.Slice(unsafe.StringData(file_organize_proto_rawDesc), len(file_organize_proto_rawDesc)),
|
||||||
NumEnums: 0,
|
NumEnums: 0,
|
||||||
NumMessages: 49,
|
NumMessages: 46,
|
||||||
NumExtensions: 0,
|
NumExtensions: 0,
|
||||||
NumServices: 5,
|
NumServices: 5,
|
||||||
},
|
},
|
||||||
|
|
|
@ -1445,22 +1445,22 @@ var _ interface {
|
||||||
ErrorName() string
|
ErrorName() string
|
||||||
} = MenuItemValidationError{}
|
} = MenuItemValidationError{}
|
||||||
|
|
||||||
// Validate checks the field values on GetUserMenuRequest with the rules
|
// Validate checks the field values on GetMenuRequest with the rules defined in
|
||||||
// defined in the proto definition for this message. If any rules are
|
// the proto definition for this message. If any rules are violated, the first
|
||||||
// violated, the first error encountered is returned, or nil if there are no violations.
|
// error encountered is returned, or nil if there are no violations.
|
||||||
func (m *GetUserMenuRequest) Validate() error {
|
func (m *GetMenuRequest) Validate() error {
|
||||||
return m.validate(false)
|
return m.validate(false)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ValidateAll checks the field values on GetUserMenuRequest with the rules
|
// ValidateAll checks the field values on GetMenuRequest with the rules defined
|
||||||
// defined in the proto definition for this message. If any rules are
|
// in the proto definition for this message. If any rules are violated, the
|
||||||
// violated, the result is a list of violation errors wrapped in
|
// result is a list of violation errors wrapped in GetMenuRequestMultiError,
|
||||||
// GetUserMenuRequestMultiError, or nil if none found.
|
// or nil if none found.
|
||||||
func (m *GetUserMenuRequest) ValidateAll() error {
|
func (m *GetMenuRequest) ValidateAll() error {
|
||||||
return m.validate(true)
|
return m.validate(true)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *GetUserMenuRequest) validate(all bool) error {
|
func (m *GetMenuRequest) validate(all bool) error {
|
||||||
if m == nil {
|
if m == nil {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -1470,19 +1470,19 @@ func (m *GetUserMenuRequest) validate(all bool) error {
|
||||||
// no validation rules for Permission
|
// no validation rules for Permission
|
||||||
|
|
||||||
if len(errors) > 0 {
|
if len(errors) > 0 {
|
||||||
return GetUserMenuRequestMultiError(errors)
|
return GetMenuRequestMultiError(errors)
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetUserMenuRequestMultiError is an error wrapping multiple validation errors
|
// GetMenuRequestMultiError is an error wrapping multiple validation errors
|
||||||
// returned by GetUserMenuRequest.ValidateAll() if the designated constraints
|
// returned by GetMenuRequest.ValidateAll() if the designated constraints
|
||||||
// aren't met.
|
// aren't met.
|
||||||
type GetUserMenuRequestMultiError []error
|
type GetMenuRequestMultiError []error
|
||||||
|
|
||||||
// Error returns a concatenation of all the error messages it wraps.
|
// Error returns a concatenation of all the error messages it wraps.
|
||||||
func (m GetUserMenuRequestMultiError) Error() string {
|
func (m GetMenuRequestMultiError) Error() string {
|
||||||
msgs := make([]string, 0, len(m))
|
msgs := make([]string, 0, len(m))
|
||||||
for _, err := range m {
|
for _, err := range m {
|
||||||
msgs = append(msgs, err.Error())
|
msgs = append(msgs, err.Error())
|
||||||
|
@ -1491,11 +1491,11 @@ func (m GetUserMenuRequestMultiError) Error() string {
|
||||||
}
|
}
|
||||||
|
|
||||||
// AllErrors returns a list of validation violation errors.
|
// AllErrors returns a list of validation violation errors.
|
||||||
func (m GetUserMenuRequestMultiError) AllErrors() []error { return m }
|
func (m GetMenuRequestMultiError) AllErrors() []error { return m }
|
||||||
|
|
||||||
// GetUserMenuRequestValidationError is the validation error returned by
|
// GetMenuRequestValidationError is the validation error returned by
|
||||||
// GetUserMenuRequest.Validate if the designated constraints aren't met.
|
// GetMenuRequest.Validate if the designated constraints aren't met.
|
||||||
type GetUserMenuRequestValidationError struct {
|
type GetMenuRequestValidationError struct {
|
||||||
field string
|
field string
|
||||||
reason string
|
reason string
|
||||||
cause error
|
cause error
|
||||||
|
@ -1503,24 +1503,22 @@ type GetUserMenuRequestValidationError struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Field function returns field value.
|
// Field function returns field value.
|
||||||
func (e GetUserMenuRequestValidationError) Field() string { return e.field }
|
func (e GetMenuRequestValidationError) Field() string { return e.field }
|
||||||
|
|
||||||
// Reason function returns reason value.
|
// Reason function returns reason value.
|
||||||
func (e GetUserMenuRequestValidationError) Reason() string { return e.reason }
|
func (e GetMenuRequestValidationError) Reason() string { return e.reason }
|
||||||
|
|
||||||
// Cause function returns cause value.
|
// Cause function returns cause value.
|
||||||
func (e GetUserMenuRequestValidationError) Cause() error { return e.cause }
|
func (e GetMenuRequestValidationError) Cause() error { return e.cause }
|
||||||
|
|
||||||
// Key function returns key value.
|
// Key function returns key value.
|
||||||
func (e GetUserMenuRequestValidationError) Key() bool { return e.key }
|
func (e GetMenuRequestValidationError) Key() bool { return e.key }
|
||||||
|
|
||||||
// ErrorName returns error name.
|
// ErrorName returns error name.
|
||||||
func (e GetUserMenuRequestValidationError) ErrorName() string {
|
func (e GetMenuRequestValidationError) ErrorName() string { return "GetMenuRequestValidationError" }
|
||||||
return "GetUserMenuRequestValidationError"
|
|
||||||
}
|
|
||||||
|
|
||||||
// Error satisfies the builtin error interface
|
// Error satisfies the builtin error interface
|
||||||
func (e GetUserMenuRequestValidationError) Error() string {
|
func (e GetMenuRequestValidationError) Error() string {
|
||||||
cause := ""
|
cause := ""
|
||||||
if e.cause != nil {
|
if e.cause != nil {
|
||||||
cause = fmt.Sprintf(" | caused by: %v", e.cause)
|
cause = fmt.Sprintf(" | caused by: %v", e.cause)
|
||||||
|
@ -1532,14 +1530,14 @@ func (e GetUserMenuRequestValidationError) Error() string {
|
||||||
}
|
}
|
||||||
|
|
||||||
return fmt.Sprintf(
|
return fmt.Sprintf(
|
||||||
"invalid %sGetUserMenuRequest.%s: %s%s",
|
"invalid %sGetMenuRequest.%s: %s%s",
|
||||||
key,
|
key,
|
||||||
e.field,
|
e.field,
|
||||||
e.reason,
|
e.reason,
|
||||||
cause)
|
cause)
|
||||||
}
|
}
|
||||||
|
|
||||||
var _ error = GetUserMenuRequestValidationError{}
|
var _ error = GetMenuRequestValidationError{}
|
||||||
|
|
||||||
var _ interface {
|
var _ interface {
|
||||||
Field() string
|
Field() string
|
||||||
|
@ -1547,24 +1545,24 @@ var _ interface {
|
||||||
Key() bool
|
Key() bool
|
||||||
Cause() error
|
Cause() error
|
||||||
ErrorName() string
|
ErrorName() string
|
||||||
} = GetUserMenuRequestValidationError{}
|
} = GetMenuRequestValidationError{}
|
||||||
|
|
||||||
// Validate checks the field values on GetUserMenuResponse with the rules
|
// Validate checks the field values on GetMenuResponse with the rules defined
|
||||||
// defined in the proto definition for this message. If any rules are
|
// in the proto definition for this message. If any rules are violated, the
|
||||||
// violated, the first error encountered is returned, or nil if there are no violations.
|
// first error encountered is returned, or nil if there are no violations.
|
||||||
func (m *GetUserMenuResponse) Validate() error {
|
func (m *GetMenuResponse) Validate() error {
|
||||||
return m.validate(false)
|
return m.validate(false)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ValidateAll checks the field values on GetUserMenuResponse with the rules
|
// ValidateAll checks the field values on GetMenuResponse with the rules
|
||||||
// defined in the proto definition for this message. If any rules are
|
// defined in the proto definition for this message. If any rules are
|
||||||
// violated, the result is a list of violation errors wrapped in
|
// violated, the result is a list of violation errors wrapped in
|
||||||
// GetUserMenuResponseMultiError, or nil if none found.
|
// GetMenuResponseMultiError, or nil if none found.
|
||||||
func (m *GetUserMenuResponse) ValidateAll() error {
|
func (m *GetMenuResponse) ValidateAll() error {
|
||||||
return m.validate(true)
|
return m.validate(true)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *GetUserMenuResponse) validate(all bool) error {
|
func (m *GetMenuResponse) validate(all bool) error {
|
||||||
if m == nil {
|
if m == nil {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -1578,7 +1576,7 @@ func (m *GetUserMenuResponse) validate(all bool) error {
|
||||||
switch v := interface{}(item).(type) {
|
switch v := interface{}(item).(type) {
|
||||||
case interface{ ValidateAll() error }:
|
case interface{ ValidateAll() error }:
|
||||||
if err := v.ValidateAll(); err != nil {
|
if err := v.ValidateAll(); err != nil {
|
||||||
errors = append(errors, GetUserMenuResponseValidationError{
|
errors = append(errors, GetMenuResponseValidationError{
|
||||||
field: fmt.Sprintf("Data[%v]", idx),
|
field: fmt.Sprintf("Data[%v]", idx),
|
||||||
reason: "embedded message failed validation",
|
reason: "embedded message failed validation",
|
||||||
cause: err,
|
cause: err,
|
||||||
|
@ -1586,7 +1584,7 @@ func (m *GetUserMenuResponse) validate(all bool) error {
|
||||||
}
|
}
|
||||||
case interface{ Validate() error }:
|
case interface{ Validate() error }:
|
||||||
if err := v.Validate(); err != nil {
|
if err := v.Validate(); err != nil {
|
||||||
errors = append(errors, GetUserMenuResponseValidationError{
|
errors = append(errors, GetMenuResponseValidationError{
|
||||||
field: fmt.Sprintf("Data[%v]", idx),
|
field: fmt.Sprintf("Data[%v]", idx),
|
||||||
reason: "embedded message failed validation",
|
reason: "embedded message failed validation",
|
||||||
cause: err,
|
cause: err,
|
||||||
|
@ -1595,7 +1593,7 @@ func (m *GetUserMenuResponse) validate(all bool) error {
|
||||||
}
|
}
|
||||||
} else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
|
} else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
|
||||||
if err := v.Validate(); err != nil {
|
if err := v.Validate(); err != nil {
|
||||||
return GetUserMenuResponseValidationError{
|
return GetMenuResponseValidationError{
|
||||||
field: fmt.Sprintf("Data[%v]", idx),
|
field: fmt.Sprintf("Data[%v]", idx),
|
||||||
reason: "embedded message failed validation",
|
reason: "embedded message failed validation",
|
||||||
cause: err,
|
cause: err,
|
||||||
|
@ -1606,19 +1604,19 @@ func (m *GetUserMenuResponse) validate(all bool) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(errors) > 0 {
|
if len(errors) > 0 {
|
||||||
return GetUserMenuResponseMultiError(errors)
|
return GetMenuResponseMultiError(errors)
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetUserMenuResponseMultiError is an error wrapping multiple validation
|
// GetMenuResponseMultiError is an error wrapping multiple validation errors
|
||||||
// errors returned by GetUserMenuResponse.ValidateAll() if the designated
|
// returned by GetMenuResponse.ValidateAll() if the designated constraints
|
||||||
// constraints aren't met.
|
// aren't met.
|
||||||
type GetUserMenuResponseMultiError []error
|
type GetMenuResponseMultiError []error
|
||||||
|
|
||||||
// Error returns a concatenation of all the error messages it wraps.
|
// Error returns a concatenation of all the error messages it wraps.
|
||||||
func (m GetUserMenuResponseMultiError) Error() string {
|
func (m GetMenuResponseMultiError) Error() string {
|
||||||
msgs := make([]string, 0, len(m))
|
msgs := make([]string, 0, len(m))
|
||||||
for _, err := range m {
|
for _, err := range m {
|
||||||
msgs = append(msgs, err.Error())
|
msgs = append(msgs, err.Error())
|
||||||
|
@ -1627,11 +1625,11 @@ func (m GetUserMenuResponseMultiError) Error() string {
|
||||||
}
|
}
|
||||||
|
|
||||||
// AllErrors returns a list of validation violation errors.
|
// AllErrors returns a list of validation violation errors.
|
||||||
func (m GetUserMenuResponseMultiError) AllErrors() []error { return m }
|
func (m GetMenuResponseMultiError) AllErrors() []error { return m }
|
||||||
|
|
||||||
// GetUserMenuResponseValidationError is the validation error returned by
|
// GetMenuResponseValidationError is the validation error returned by
|
||||||
// GetUserMenuResponse.Validate if the designated constraints aren't met.
|
// GetMenuResponse.Validate if the designated constraints aren't met.
|
||||||
type GetUserMenuResponseValidationError struct {
|
type GetMenuResponseValidationError struct {
|
||||||
field string
|
field string
|
||||||
reason string
|
reason string
|
||||||
cause error
|
cause error
|
||||||
|
@ -1639,24 +1637,22 @@ type GetUserMenuResponseValidationError struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Field function returns field value.
|
// Field function returns field value.
|
||||||
func (e GetUserMenuResponseValidationError) Field() string { return e.field }
|
func (e GetMenuResponseValidationError) Field() string { return e.field }
|
||||||
|
|
||||||
// Reason function returns reason value.
|
// Reason function returns reason value.
|
||||||
func (e GetUserMenuResponseValidationError) Reason() string { return e.reason }
|
func (e GetMenuResponseValidationError) Reason() string { return e.reason }
|
||||||
|
|
||||||
// Cause function returns cause value.
|
// Cause function returns cause value.
|
||||||
func (e GetUserMenuResponseValidationError) Cause() error { return e.cause }
|
func (e GetMenuResponseValidationError) Cause() error { return e.cause }
|
||||||
|
|
||||||
// Key function returns key value.
|
// Key function returns key value.
|
||||||
func (e GetUserMenuResponseValidationError) Key() bool { return e.key }
|
func (e GetMenuResponseValidationError) Key() bool { return e.key }
|
||||||
|
|
||||||
// ErrorName returns error name.
|
// ErrorName returns error name.
|
||||||
func (e GetUserMenuResponseValidationError) ErrorName() string {
|
func (e GetMenuResponseValidationError) ErrorName() string { return "GetMenuResponseValidationError" }
|
||||||
return "GetUserMenuResponseValidationError"
|
|
||||||
}
|
|
||||||
|
|
||||||
// Error satisfies the builtin error interface
|
// Error satisfies the builtin error interface
|
||||||
func (e GetUserMenuResponseValidationError) Error() string {
|
func (e GetMenuResponseValidationError) Error() string {
|
||||||
cause := ""
|
cause := ""
|
||||||
if e.cause != nil {
|
if e.cause != nil {
|
||||||
cause = fmt.Sprintf(" | caused by: %v", e.cause)
|
cause = fmt.Sprintf(" | caused by: %v", e.cause)
|
||||||
|
@ -1668,14 +1664,14 @@ func (e GetUserMenuResponseValidationError) Error() string {
|
||||||
}
|
}
|
||||||
|
|
||||||
return fmt.Sprintf(
|
return fmt.Sprintf(
|
||||||
"invalid %sGetUserMenuResponse.%s: %s%s",
|
"invalid %sGetMenuResponse.%s: %s%s",
|
||||||
key,
|
key,
|
||||||
e.field,
|
e.field,
|
||||||
e.reason,
|
e.reason,
|
||||||
cause)
|
cause)
|
||||||
}
|
}
|
||||||
|
|
||||||
var _ error = GetUserMenuResponseValidationError{}
|
var _ error = GetMenuResponseValidationError{}
|
||||||
|
|
||||||
var _ interface {
|
var _ interface {
|
||||||
Field() string
|
Field() string
|
||||||
|
@ -1683,7 +1679,7 @@ var _ interface {
|
||||||
Key() bool
|
Key() bool
|
||||||
Cause() error
|
Cause() error
|
||||||
ErrorName() string
|
ErrorName() string
|
||||||
} = GetUserMenuResponseValidationError{}
|
} = GetMenuResponseValidationError{}
|
||||||
|
|
||||||
// Validate checks the field values on GetProfileRequest with the rules defined
|
// Validate checks the field values on GetProfileRequest with the rules defined
|
||||||
// in the proto definition for this message. If any rules are violated, the
|
// in the proto definition for this message. If any rules are violated, the
|
||||||
|
@ -5153,381 +5149,6 @@ var _ interface {
|
||||||
ErrorName() string
|
ErrorName() string
|
||||||
} = GetMenuLevelLabelsResponseValidationError{}
|
} = GetMenuLevelLabelsResponseValidationError{}
|
||||||
|
|
||||||
// Validate checks the field values on MenuValue with the rules defined in the
|
|
||||||
// proto definition for this message. If any rules are violated, the first
|
|
||||||
// error encountered is returned, or nil if there are no violations.
|
|
||||||
func (m *MenuValue) Validate() error {
|
|
||||||
return m.validate(false)
|
|
||||||
}
|
|
||||||
|
|
||||||
// ValidateAll checks the field values on MenuValue with the rules defined in
|
|
||||||
// the proto definition for this message. If any rules are violated, the
|
|
||||||
// result is a list of violation errors wrapped in MenuValueMultiError, or nil
|
|
||||||
// if none found.
|
|
||||||
func (m *MenuValue) ValidateAll() error {
|
|
||||||
return m.validate(true)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *MenuValue) validate(all bool) error {
|
|
||||||
if m == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
var errors []error
|
|
||||||
|
|
||||||
// no validation rules for Id
|
|
||||||
|
|
||||||
// no validation rules for Parent
|
|
||||||
|
|
||||||
// no validation rules for Name
|
|
||||||
|
|
||||||
// no validation rules for Label
|
|
||||||
|
|
||||||
for idx, item := range m.GetChildren() {
|
|
||||||
_, _ = idx, item
|
|
||||||
|
|
||||||
if all {
|
|
||||||
switch v := interface{}(item).(type) {
|
|
||||||
case interface{ ValidateAll() error }:
|
|
||||||
if err := v.ValidateAll(); err != nil {
|
|
||||||
errors = append(errors, MenuValueValidationError{
|
|
||||||
field: fmt.Sprintf("Children[%v]", idx),
|
|
||||||
reason: "embedded message failed validation",
|
|
||||||
cause: err,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
case interface{ Validate() error }:
|
|
||||||
if err := v.Validate(); err != nil {
|
|
||||||
errors = append(errors, MenuValueValidationError{
|
|
||||||
field: fmt.Sprintf("Children[%v]", idx),
|
|
||||||
reason: "embedded message failed validation",
|
|
||||||
cause: err,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
|
|
||||||
if err := v.Validate(); err != nil {
|
|
||||||
return MenuValueValidationError{
|
|
||||||
field: fmt.Sprintf("Children[%v]", idx),
|
|
||||||
reason: "embedded message failed validation",
|
|
||||||
cause: err,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
if len(errors) > 0 {
|
|
||||||
return MenuValueMultiError(errors)
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// MenuValueMultiError is an error wrapping multiple validation errors returned
|
|
||||||
// by MenuValue.ValidateAll() if the designated constraints aren't met.
|
|
||||||
type MenuValueMultiError []error
|
|
||||||
|
|
||||||
// Error returns a concatenation of all the error messages it wraps.
|
|
||||||
func (m MenuValueMultiError) Error() string {
|
|
||||||
msgs := make([]string, 0, len(m))
|
|
||||||
for _, err := range m {
|
|
||||||
msgs = append(msgs, err.Error())
|
|
||||||
}
|
|
||||||
return strings.Join(msgs, "; ")
|
|
||||||
}
|
|
||||||
|
|
||||||
// AllErrors returns a list of validation violation errors.
|
|
||||||
func (m MenuValueMultiError) AllErrors() []error { return m }
|
|
||||||
|
|
||||||
// MenuValueValidationError is the validation error returned by
|
|
||||||
// MenuValue.Validate if the designated constraints aren't met.
|
|
||||||
type MenuValueValidationError struct {
|
|
||||||
field string
|
|
||||||
reason string
|
|
||||||
cause error
|
|
||||||
key bool
|
|
||||||
}
|
|
||||||
|
|
||||||
// Field function returns field value.
|
|
||||||
func (e MenuValueValidationError) Field() string { return e.field }
|
|
||||||
|
|
||||||
// Reason function returns reason value.
|
|
||||||
func (e MenuValueValidationError) Reason() string { return e.reason }
|
|
||||||
|
|
||||||
// Cause function returns cause value.
|
|
||||||
func (e MenuValueValidationError) Cause() error { return e.cause }
|
|
||||||
|
|
||||||
// Key function returns key value.
|
|
||||||
func (e MenuValueValidationError) Key() bool { return e.key }
|
|
||||||
|
|
||||||
// ErrorName returns error name.
|
|
||||||
func (e MenuValueValidationError) ErrorName() string { return "MenuValueValidationError" }
|
|
||||||
|
|
||||||
// Error satisfies the builtin error interface
|
|
||||||
func (e MenuValueValidationError) Error() string {
|
|
||||||
cause := ""
|
|
||||||
if e.cause != nil {
|
|
||||||
cause = fmt.Sprintf(" | caused by: %v", e.cause)
|
|
||||||
}
|
|
||||||
|
|
||||||
key := ""
|
|
||||||
if e.key {
|
|
||||||
key = "key for "
|
|
||||||
}
|
|
||||||
|
|
||||||
return fmt.Sprintf(
|
|
||||||
"invalid %sMenuValue.%s: %s%s",
|
|
||||||
key,
|
|
||||||
e.field,
|
|
||||||
e.reason,
|
|
||||||
cause)
|
|
||||||
}
|
|
||||||
|
|
||||||
var _ error = MenuValueValidationError{}
|
|
||||||
|
|
||||||
var _ interface {
|
|
||||||
Field() string
|
|
||||||
Reason() string
|
|
||||||
Key() bool
|
|
||||||
Cause() error
|
|
||||||
ErrorName() string
|
|
||||||
} = MenuValueValidationError{}
|
|
||||||
|
|
||||||
// Validate checks the field values on GetMenuRequest with the rules defined in
|
|
||||||
// the proto definition for this message. If any rules are violated, the first
|
|
||||||
// error encountered is returned, or nil if there are no violations.
|
|
||||||
func (m *GetMenuRequest) Validate() error {
|
|
||||||
return m.validate(false)
|
|
||||||
}
|
|
||||||
|
|
||||||
// ValidateAll checks the field values on GetMenuRequest with the rules defined
|
|
||||||
// in the proto definition for this message. If any rules are violated, the
|
|
||||||
// result is a list of violation errors wrapped in GetMenuRequestMultiError,
|
|
||||||
// or nil if none found.
|
|
||||||
func (m *GetMenuRequest) ValidateAll() error {
|
|
||||||
return m.validate(true)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *GetMenuRequest) validate(all bool) error {
|
|
||||||
if m == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
var errors []error
|
|
||||||
|
|
||||||
if len(errors) > 0 {
|
|
||||||
return GetMenuRequestMultiError(errors)
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetMenuRequestMultiError is an error wrapping multiple validation errors
|
|
||||||
// returned by GetMenuRequest.ValidateAll() if the designated constraints
|
|
||||||
// aren't met.
|
|
||||||
type GetMenuRequestMultiError []error
|
|
||||||
|
|
||||||
// Error returns a concatenation of all the error messages it wraps.
|
|
||||||
func (m GetMenuRequestMultiError) Error() string {
|
|
||||||
msgs := make([]string, 0, len(m))
|
|
||||||
for _, err := range m {
|
|
||||||
msgs = append(msgs, err.Error())
|
|
||||||
}
|
|
||||||
return strings.Join(msgs, "; ")
|
|
||||||
}
|
|
||||||
|
|
||||||
// AllErrors returns a list of validation violation errors.
|
|
||||||
func (m GetMenuRequestMultiError) AllErrors() []error { return m }
|
|
||||||
|
|
||||||
// GetMenuRequestValidationError is the validation error returned by
|
|
||||||
// GetMenuRequest.Validate if the designated constraints aren't met.
|
|
||||||
type GetMenuRequestValidationError struct {
|
|
||||||
field string
|
|
||||||
reason string
|
|
||||||
cause error
|
|
||||||
key bool
|
|
||||||
}
|
|
||||||
|
|
||||||
// Field function returns field value.
|
|
||||||
func (e GetMenuRequestValidationError) Field() string { return e.field }
|
|
||||||
|
|
||||||
// Reason function returns reason value.
|
|
||||||
func (e GetMenuRequestValidationError) Reason() string { return e.reason }
|
|
||||||
|
|
||||||
// Cause function returns cause value.
|
|
||||||
func (e GetMenuRequestValidationError) Cause() error { return e.cause }
|
|
||||||
|
|
||||||
// Key function returns key value.
|
|
||||||
func (e GetMenuRequestValidationError) Key() bool { return e.key }
|
|
||||||
|
|
||||||
// ErrorName returns error name.
|
|
||||||
func (e GetMenuRequestValidationError) ErrorName() string { return "GetMenuRequestValidationError" }
|
|
||||||
|
|
||||||
// Error satisfies the builtin error interface
|
|
||||||
func (e GetMenuRequestValidationError) Error() string {
|
|
||||||
cause := ""
|
|
||||||
if e.cause != nil {
|
|
||||||
cause = fmt.Sprintf(" | caused by: %v", e.cause)
|
|
||||||
}
|
|
||||||
|
|
||||||
key := ""
|
|
||||||
if e.key {
|
|
||||||
key = "key for "
|
|
||||||
}
|
|
||||||
|
|
||||||
return fmt.Sprintf(
|
|
||||||
"invalid %sGetMenuRequest.%s: %s%s",
|
|
||||||
key,
|
|
||||||
e.field,
|
|
||||||
e.reason,
|
|
||||||
cause)
|
|
||||||
}
|
|
||||||
|
|
||||||
var _ error = GetMenuRequestValidationError{}
|
|
||||||
|
|
||||||
var _ interface {
|
|
||||||
Field() string
|
|
||||||
Reason() string
|
|
||||||
Key() bool
|
|
||||||
Cause() error
|
|
||||||
ErrorName() string
|
|
||||||
} = GetMenuRequestValidationError{}
|
|
||||||
|
|
||||||
// Validate checks the field values on GetMenuResponse with the rules defined
|
|
||||||
// in the proto definition for this message. If any rules are violated, the
|
|
||||||
// first error encountered is returned, or nil if there are no violations.
|
|
||||||
func (m *GetMenuResponse) Validate() error {
|
|
||||||
return m.validate(false)
|
|
||||||
}
|
|
||||||
|
|
||||||
// ValidateAll checks the field values on GetMenuResponse with the rules
|
|
||||||
// defined in the proto definition for this message. If any rules are
|
|
||||||
// violated, the result is a list of violation errors wrapped in
|
|
||||||
// GetMenuResponseMultiError, or nil if none found.
|
|
||||||
func (m *GetMenuResponse) ValidateAll() error {
|
|
||||||
return m.validate(true)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *GetMenuResponse) validate(all bool) error {
|
|
||||||
if m == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
var errors []error
|
|
||||||
|
|
||||||
for idx, item := range m.GetData() {
|
|
||||||
_, _ = idx, item
|
|
||||||
|
|
||||||
if all {
|
|
||||||
switch v := interface{}(item).(type) {
|
|
||||||
case interface{ ValidateAll() error }:
|
|
||||||
if err := v.ValidateAll(); err != nil {
|
|
||||||
errors = append(errors, GetMenuResponseValidationError{
|
|
||||||
field: fmt.Sprintf("Data[%v]", idx),
|
|
||||||
reason: "embedded message failed validation",
|
|
||||||
cause: err,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
case interface{ Validate() error }:
|
|
||||||
if err := v.Validate(); err != nil {
|
|
||||||
errors = append(errors, GetMenuResponseValidationError{
|
|
||||||
field: fmt.Sprintf("Data[%v]", idx),
|
|
||||||
reason: "embedded message failed validation",
|
|
||||||
cause: err,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
|
|
||||||
if err := v.Validate(); err != nil {
|
|
||||||
return GetMenuResponseValidationError{
|
|
||||||
field: fmt.Sprintf("Data[%v]", idx),
|
|
||||||
reason: "embedded message failed validation",
|
|
||||||
cause: err,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
if len(errors) > 0 {
|
|
||||||
return GetMenuResponseMultiError(errors)
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetMenuResponseMultiError is an error wrapping multiple validation errors
|
|
||||||
// returned by GetMenuResponse.ValidateAll() if the designated constraints
|
|
||||||
// aren't met.
|
|
||||||
type GetMenuResponseMultiError []error
|
|
||||||
|
|
||||||
// Error returns a concatenation of all the error messages it wraps.
|
|
||||||
func (m GetMenuResponseMultiError) Error() string {
|
|
||||||
msgs := make([]string, 0, len(m))
|
|
||||||
for _, err := range m {
|
|
||||||
msgs = append(msgs, err.Error())
|
|
||||||
}
|
|
||||||
return strings.Join(msgs, "; ")
|
|
||||||
}
|
|
||||||
|
|
||||||
// AllErrors returns a list of validation violation errors.
|
|
||||||
func (m GetMenuResponseMultiError) AllErrors() []error { return m }
|
|
||||||
|
|
||||||
// GetMenuResponseValidationError is the validation error returned by
|
|
||||||
// GetMenuResponse.Validate if the designated constraints aren't met.
|
|
||||||
type GetMenuResponseValidationError struct {
|
|
||||||
field string
|
|
||||||
reason string
|
|
||||||
cause error
|
|
||||||
key bool
|
|
||||||
}
|
|
||||||
|
|
||||||
// Field function returns field value.
|
|
||||||
func (e GetMenuResponseValidationError) Field() string { return e.field }
|
|
||||||
|
|
||||||
// Reason function returns reason value.
|
|
||||||
func (e GetMenuResponseValidationError) Reason() string { return e.reason }
|
|
||||||
|
|
||||||
// Cause function returns cause value.
|
|
||||||
func (e GetMenuResponseValidationError) Cause() error { return e.cause }
|
|
||||||
|
|
||||||
// Key function returns key value.
|
|
||||||
func (e GetMenuResponseValidationError) Key() bool { return e.key }
|
|
||||||
|
|
||||||
// ErrorName returns error name.
|
|
||||||
func (e GetMenuResponseValidationError) ErrorName() string { return "GetMenuResponseValidationError" }
|
|
||||||
|
|
||||||
// Error satisfies the builtin error interface
|
|
||||||
func (e GetMenuResponseValidationError) Error() string {
|
|
||||||
cause := ""
|
|
||||||
if e.cause != nil {
|
|
||||||
cause = fmt.Sprintf(" | caused by: %v", e.cause)
|
|
||||||
}
|
|
||||||
|
|
||||||
key := ""
|
|
||||||
if e.key {
|
|
||||||
key = "key for "
|
|
||||||
}
|
|
||||||
|
|
||||||
return fmt.Sprintf(
|
|
||||||
"invalid %sGetMenuResponse.%s: %s%s",
|
|
||||||
key,
|
|
||||||
e.field,
|
|
||||||
e.reason,
|
|
||||||
cause)
|
|
||||||
}
|
|
||||||
|
|
||||||
var _ error = GetMenuResponseValidationError{}
|
|
||||||
|
|
||||||
var _ interface {
|
|
||||||
Field() string
|
|
||||||
Reason() string
|
|
||||||
Key() bool
|
|
||||||
Cause() error
|
|
||||||
ErrorName() string
|
|
||||||
} = GetMenuResponseValidationError{}
|
|
||||||
|
|
||||||
// Validate checks the field values on LoginRequest with the rules defined in
|
// Validate checks the field values on LoginRequest with the rules defined in
|
||||||
// the proto definition for this message. If any rules are violated, the first
|
// the proto definition for this message. If any rules are violated, the first
|
||||||
// error encountered is returned, or nil if there are no violations.
|
// error encountered is returned, or nil if there are no violations.
|
||||||
|
|
|
@ -17,7 +17,7 @@ message Menu {
|
||||||
int64 id = 1 [(aeus.field) = {gorm:"primaryKey",comment:"菜单ID"}];
|
int64 id = 1 [(aeus.field) = {gorm:"primaryKey",comment:"菜单ID"}];
|
||||||
int64 created_at = 2 [(aeus.field)={scenarios:"view;export",comment:"创建时间"}];
|
int64 created_at = 2 [(aeus.field)={scenarios:"view;export",comment:"创建时间"}];
|
||||||
int64 updated_at = 3 [(aeus.field)={gorm:"index",scenarios:"view;export",comment:"更新时间"}];
|
int64 updated_at = 3 [(aeus.field)={gorm:"index",scenarios:"view;export",comment:"更新时间"}];
|
||||||
string parent = 4 [(aeus.field)={gorm:"index;size:60",scenarios:"create;update;view;export",props:"readonly:update",live:"type:dropdown;url:/menu/level-labels",format:"menu",comment:"父级菜单"}];
|
string parent = 4 [(aeus.field)={gorm:"index;size:60",props:"readonly:update",live:"type:dropdown;url:/menu/level-labels",format:"menu",comment:"父级菜单"}];
|
||||||
string name = 5 [(aeus.field)={gorm:"index;size:60",props:"readonly:update",rule:"unique;required",comment: "组件名称"},(validate.rules).string = {max_len: 60}];
|
string name = 5 [(aeus.field)={gorm:"index;size:60",props:"readonly:update",rule:"unique;required",comment: "组件名称"},(validate.rules).string = {max_len: 60}];
|
||||||
string label = 6 [(aeus.field)={gorm:"size:120",rule:"required",comment: "菜单标题"},(validate.rules).string = {max_len: 120}];
|
string label = 6 [(aeus.field)={gorm:"size:120",rule:"required",comment: "菜单标题"},(validate.rules).string = {max_len: 120}];
|
||||||
string uri = 7 [(aeus.field)={gorm:"size:512",rule:"required",scenarios:"create;update;view;export",comment: "菜单链接"},(validate.rules).string = {max_len: 512}];
|
string uri = 7 [(aeus.field)={gorm:"size:512",rule:"required",scenarios:"create;update;view;export",comment: "菜单链接"},(validate.rules).string = {max_len: 512}];
|
||||||
|
@ -25,7 +25,7 @@ message Menu {
|
||||||
string icon = 9 [(aeus.field)={gorm:"size:60",scenarios:"create;update;view;export",comment: "菜单图标"},(validate.rules).string = {max_len: 60}];
|
string icon = 9 [(aeus.field)={gorm:"size:60",scenarios:"create;update;view;export",comment: "菜单图标"},(validate.rules).string = {max_len: 60}];
|
||||||
bool hidden = 10 [(aeus.field)={scenarios:"create;update;view;export",comment:"是否隐藏"}];
|
bool hidden = 10 [(aeus.field)={scenarios:"create;update;view;export",comment:"是否隐藏"}];
|
||||||
bool public = 11 [(aeus.field)={scenarios:"create;update;view;export",comment:"是否公开"}];
|
bool public = 11 [(aeus.field)={scenarios:"create;update;view;export",comment:"是否公开"}];
|
||||||
string description = 12 [(aeus.field)={gorm:"size:1024",scenarios:"create;update;view;export",format:"textarea",comment: "备注说明"},(validate.rules).string = {max_len: 1024}];
|
string description = 12 [(aeus.field)={gorm:"size:1024",scenarios:"create;update;view;export;list",format:"textarea",comment: "备注说明"},(validate.rules).string = {max_len: 1024}];
|
||||||
int64 position = 13 [(aeus.field)={comment:"排序",scenarios:"create;update"}];
|
int64 position = 13 [(aeus.field)={comment:"排序",scenarios:"create;update"}];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,8 +37,8 @@ message Role {
|
||||||
int64 id = 1 [(aeus.field) = {gorm:"primaryKey",comment: "角色ID"}];
|
int64 id = 1 [(aeus.field) = {gorm:"primaryKey",comment: "角色ID"}];
|
||||||
int64 created_at = 2 [(aeus.field)={scenarios:"view;export",comment:"创建时间"}];
|
int64 created_at = 2 [(aeus.field)={scenarios:"view;export",comment:"创建时间"}];
|
||||||
int64 updated_at = 3 [(aeus.field)={gorm:"index",scenarios:"view;export",comment:"更新时间"}];
|
int64 updated_at = 3 [(aeus.field)={gorm:"index",scenarios:"view;export",comment:"更新时间"}];
|
||||||
string name = 4 [(aeus.field)={gorm:"index;size:60",rule:"required",props:"readonly:update",comment: "角色名称"},(validate.rules).string = {max_len: 60}];
|
string name = 4 [(aeus.field)={gorm:"index;size:60",props:"readonly:update",comment: "角色名称"},(validate.rules).string = {max_len: 60}];
|
||||||
string label = 5 [(aeus.field)={gorm:"size:60",rule:"required",comment: "角色标题"},(validate.rules).string = {max_len: 60}];
|
string label = 5 [(aeus.field)={gorm:"size:60",comment: "角色标题"},(validate.rules).string = {max_len: 60}];
|
||||||
string description = 6 [(aeus.field)={gorm:"size:1024",scenarios:"list;create;update;export",format:"textarea",comment: "备注说明"},(validate.rules).string = {max_len: 1024}];
|
string description = 6 [(aeus.field)={gorm:"size:1024",scenarios:"list;create;update;export",format:"textarea",comment: "备注说明"},(validate.rules).string = {max_len: 1024}];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -139,12 +139,12 @@ message MenuItem {
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取菜单的请求
|
// 获取菜单的请求
|
||||||
message GetUserMenuRequest {
|
message GetMenuRequest {
|
||||||
bool permission = 1;
|
bool permission = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取菜单的响应
|
// 获取菜单的响应
|
||||||
message GetUserMenuResponse {
|
message GetMenuResponse {
|
||||||
repeated MenuItem data = 1;
|
repeated MenuItem data = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -213,7 +213,7 @@ message GetUserTagResponse {
|
||||||
// 用户服务
|
// 用户服务
|
||||||
service UserService {
|
service UserService {
|
||||||
// 获取用户菜单
|
// 获取用户菜单
|
||||||
rpc GetMenus(GetUserMenuRequest) returns (GetUserMenuResponse) {
|
rpc GetMenus(GetMenuRequest) returns (GetMenuResponse) {
|
||||||
option (google.api.http) = {
|
option (google.api.http) = {
|
||||||
get: "/user/menus"
|
get: "/user/menus"
|
||||||
};
|
};
|
||||||
|
@ -377,28 +377,7 @@ message GetMenuLevelLabelsResponse {
|
||||||
repeated MenuLevelValue data = 1;
|
repeated MenuLevelValue data = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
message MenuValue {
|
|
||||||
int64 id = 1;
|
|
||||||
string parent = 2;
|
|
||||||
string name = 3;
|
|
||||||
string label = 4;
|
|
||||||
repeated MenuValue children = 5;
|
|
||||||
}
|
|
||||||
|
|
||||||
message GetMenuRequest{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
message GetMenuResponse{
|
|
||||||
repeated MenuValue data = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
service MenuService {
|
service MenuService {
|
||||||
rpc GetMenus(GetMenuRequest) returns (GetMenuResponse) {
|
|
||||||
option (google.api.http) = {
|
|
||||||
get: "/menu/list"
|
|
||||||
};
|
|
||||||
}
|
|
||||||
rpc GetMenuLevelLabels(GetMenuLevelLabelsRequest) returns (GetMenuLevelLabelsResponse) {
|
rpc GetMenuLevelLabels(GetMenuLevelLabelsRequest) returns (GetMenuLevelLabelsResponse) {
|
||||||
option (google.api.http) = {
|
option (google.api.http) = {
|
||||||
get: "/menu/level-labels"
|
get: "/menu/level-labels"
|
||||||
|
|
|
@ -35,7 +35,7 @@ const (
|
||||||
// 用户服务
|
// 用户服务
|
||||||
type UserServiceClient interface {
|
type UserServiceClient interface {
|
||||||
// 获取用户菜单
|
// 获取用户菜单
|
||||||
GetMenus(ctx context.Context, in *GetUserMenuRequest, opts ...grpc.CallOption) (*GetUserMenuResponse, error)
|
GetMenus(ctx context.Context, in *GetMenuRequest, opts ...grpc.CallOption) (*GetMenuResponse, error)
|
||||||
// 获取用户信息
|
// 获取用户信息
|
||||||
GetProfile(ctx context.Context, in *GetProfileRequest, opts ...grpc.CallOption) (*GetProfileResponse, error)
|
GetProfile(ctx context.Context, in *GetProfileRequest, opts ...grpc.CallOption) (*GetProfileResponse, error)
|
||||||
// 更新用户信息
|
// 更新用户信息
|
||||||
|
@ -58,9 +58,9 @@ func NewUserServiceClient(cc grpc.ClientConnInterface) UserServiceClient {
|
||||||
return &userServiceClient{cc}
|
return &userServiceClient{cc}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *userServiceClient) GetMenus(ctx context.Context, in *GetUserMenuRequest, opts ...grpc.CallOption) (*GetUserMenuResponse, error) {
|
func (c *userServiceClient) GetMenus(ctx context.Context, in *GetMenuRequest, opts ...grpc.CallOption) (*GetMenuResponse, error) {
|
||||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||||
out := new(GetUserMenuResponse)
|
out := new(GetMenuResponse)
|
||||||
err := c.cc.Invoke(ctx, UserService_GetMenus_FullMethodName, in, out, cOpts...)
|
err := c.cc.Invoke(ctx, UserService_GetMenus_FullMethodName, in, out, cOpts...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
@ -135,7 +135,7 @@ func (c *userServiceClient) GetUserTags(ctx context.Context, in *GetUserTagReque
|
||||||
// 用户服务
|
// 用户服务
|
||||||
type UserServiceServer interface {
|
type UserServiceServer interface {
|
||||||
// 获取用户菜单
|
// 获取用户菜单
|
||||||
GetMenus(context.Context, *GetUserMenuRequest) (*GetUserMenuResponse, error)
|
GetMenus(context.Context, *GetMenuRequest) (*GetMenuResponse, error)
|
||||||
// 获取用户信息
|
// 获取用户信息
|
||||||
GetProfile(context.Context, *GetProfileRequest) (*GetProfileResponse, error)
|
GetProfile(context.Context, *GetProfileRequest) (*GetProfileResponse, error)
|
||||||
// 更新用户信息
|
// 更新用户信息
|
||||||
|
@ -158,7 +158,7 @@ type UserServiceServer interface {
|
||||||
// pointer dereference when methods are called.
|
// pointer dereference when methods are called.
|
||||||
type UnimplementedUserServiceServer struct{}
|
type UnimplementedUserServiceServer struct{}
|
||||||
|
|
||||||
func (UnimplementedUserServiceServer) GetMenus(context.Context, *GetUserMenuRequest) (*GetUserMenuResponse, error) {
|
func (UnimplementedUserServiceServer) GetMenus(context.Context, *GetMenuRequest) (*GetMenuResponse, error) {
|
||||||
return nil, status.Errorf(codes.Unimplemented, "method GetMenus not implemented")
|
return nil, status.Errorf(codes.Unimplemented, "method GetMenus not implemented")
|
||||||
}
|
}
|
||||||
func (UnimplementedUserServiceServer) GetProfile(context.Context, *GetProfileRequest) (*GetProfileResponse, error) {
|
func (UnimplementedUserServiceServer) GetProfile(context.Context, *GetProfileRequest) (*GetProfileResponse, error) {
|
||||||
|
@ -201,7 +201,7 @@ func RegisterUserServiceServer(s grpc.ServiceRegistrar, srv UserServiceServer) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func _UserService_GetMenus_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
func _UserService_GetMenus_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||||
in := new(GetUserMenuRequest)
|
in := new(GetMenuRequest)
|
||||||
if err := dec(in); err != nil {
|
if err := dec(in); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -213,7 +213,7 @@ func _UserService_GetMenus_Handler(srv interface{}, ctx context.Context, dec fun
|
||||||
FullMethod: UserService_GetMenus_FullMethodName,
|
FullMethod: UserService_GetMenus_FullMethodName,
|
||||||
}
|
}
|
||||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
return srv.(UserServiceServer).GetMenus(ctx, req.(*GetUserMenuRequest))
|
return srv.(UserServiceServer).GetMenus(ctx, req.(*GetMenuRequest))
|
||||||
}
|
}
|
||||||
return interceptor(ctx, in, info, handler)
|
return interceptor(ctx, in, info, handler)
|
||||||
}
|
}
|
||||||
|
@ -729,7 +729,6 @@ var RoleService_ServiceDesc = grpc.ServiceDesc{
|
||||||
}
|
}
|
||||||
|
|
||||||
const (
|
const (
|
||||||
MenuService_GetMenus_FullMethodName = "/organize.MenuService/GetMenus"
|
|
||||||
MenuService_GetMenuLevelLabels_FullMethodName = "/organize.MenuService/GetMenuLevelLabels"
|
MenuService_GetMenuLevelLabels_FullMethodName = "/organize.MenuService/GetMenuLevelLabels"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -737,7 +736,6 @@ const (
|
||||||
//
|
//
|
||||||
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
|
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
|
||||||
type MenuServiceClient interface {
|
type MenuServiceClient interface {
|
||||||
GetMenus(ctx context.Context, in *GetMenuRequest, opts ...grpc.CallOption) (*GetMenuResponse, error)
|
|
||||||
GetMenuLevelLabels(ctx context.Context, in *GetMenuLevelLabelsRequest, opts ...grpc.CallOption) (*GetMenuLevelLabelsResponse, error)
|
GetMenuLevelLabels(ctx context.Context, in *GetMenuLevelLabelsRequest, opts ...grpc.CallOption) (*GetMenuLevelLabelsResponse, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -749,16 +747,6 @@ func NewMenuServiceClient(cc grpc.ClientConnInterface) MenuServiceClient {
|
||||||
return &menuServiceClient{cc}
|
return &menuServiceClient{cc}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *menuServiceClient) GetMenus(ctx context.Context, in *GetMenuRequest, opts ...grpc.CallOption) (*GetMenuResponse, error) {
|
|
||||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
|
||||||
out := new(GetMenuResponse)
|
|
||||||
err := c.cc.Invoke(ctx, MenuService_GetMenus_FullMethodName, in, out, cOpts...)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return out, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *menuServiceClient) GetMenuLevelLabels(ctx context.Context, in *GetMenuLevelLabelsRequest, opts ...grpc.CallOption) (*GetMenuLevelLabelsResponse, error) {
|
func (c *menuServiceClient) GetMenuLevelLabels(ctx context.Context, in *GetMenuLevelLabelsRequest, opts ...grpc.CallOption) (*GetMenuLevelLabelsResponse, error) {
|
||||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||||
out := new(GetMenuLevelLabelsResponse)
|
out := new(GetMenuLevelLabelsResponse)
|
||||||
|
@ -773,7 +761,6 @@ func (c *menuServiceClient) GetMenuLevelLabels(ctx context.Context, in *GetMenuL
|
||||||
// All implementations must embed UnimplementedMenuServiceServer
|
// All implementations must embed UnimplementedMenuServiceServer
|
||||||
// for forward compatibility.
|
// for forward compatibility.
|
||||||
type MenuServiceServer interface {
|
type MenuServiceServer interface {
|
||||||
GetMenus(context.Context, *GetMenuRequest) (*GetMenuResponse, error)
|
|
||||||
GetMenuLevelLabels(context.Context, *GetMenuLevelLabelsRequest) (*GetMenuLevelLabelsResponse, error)
|
GetMenuLevelLabels(context.Context, *GetMenuLevelLabelsRequest) (*GetMenuLevelLabelsResponse, error)
|
||||||
mustEmbedUnimplementedMenuServiceServer()
|
mustEmbedUnimplementedMenuServiceServer()
|
||||||
}
|
}
|
||||||
|
@ -785,9 +772,6 @@ type MenuServiceServer interface {
|
||||||
// pointer dereference when methods are called.
|
// pointer dereference when methods are called.
|
||||||
type UnimplementedMenuServiceServer struct{}
|
type UnimplementedMenuServiceServer struct{}
|
||||||
|
|
||||||
func (UnimplementedMenuServiceServer) GetMenus(context.Context, *GetMenuRequest) (*GetMenuResponse, error) {
|
|
||||||
return nil, status.Errorf(codes.Unimplemented, "method GetMenus not implemented")
|
|
||||||
}
|
|
||||||
func (UnimplementedMenuServiceServer) GetMenuLevelLabels(context.Context, *GetMenuLevelLabelsRequest) (*GetMenuLevelLabelsResponse, error) {
|
func (UnimplementedMenuServiceServer) GetMenuLevelLabels(context.Context, *GetMenuLevelLabelsRequest) (*GetMenuLevelLabelsResponse, error) {
|
||||||
return nil, status.Errorf(codes.Unimplemented, "method GetMenuLevelLabels not implemented")
|
return nil, status.Errorf(codes.Unimplemented, "method GetMenuLevelLabels not implemented")
|
||||||
}
|
}
|
||||||
|
@ -812,24 +796,6 @@ func RegisterMenuServiceServer(s grpc.ServiceRegistrar, srv MenuServiceServer) {
|
||||||
s.RegisterService(&MenuService_ServiceDesc, srv)
|
s.RegisterService(&MenuService_ServiceDesc, srv)
|
||||||
}
|
}
|
||||||
|
|
||||||
func _MenuService_GetMenus_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
|
||||||
in := new(GetMenuRequest)
|
|
||||||
if err := dec(in); err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
if interceptor == nil {
|
|
||||||
return srv.(MenuServiceServer).GetMenus(ctx, in)
|
|
||||||
}
|
|
||||||
info := &grpc.UnaryServerInfo{
|
|
||||||
Server: srv,
|
|
||||||
FullMethod: MenuService_GetMenus_FullMethodName,
|
|
||||||
}
|
|
||||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
|
||||||
return srv.(MenuServiceServer).GetMenus(ctx, req.(*GetMenuRequest))
|
|
||||||
}
|
|
||||||
return interceptor(ctx, in, info, handler)
|
|
||||||
}
|
|
||||||
|
|
||||||
func _MenuService_GetMenuLevelLabels_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
func _MenuService_GetMenuLevelLabels_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||||
in := new(GetMenuLevelLabelsRequest)
|
in := new(GetMenuLevelLabelsRequest)
|
||||||
if err := dec(in); err != nil {
|
if err := dec(in); err != nil {
|
||||||
|
@ -855,10 +821,6 @@ var MenuService_ServiceDesc = grpc.ServiceDesc{
|
||||||
ServiceName: "organize.MenuService",
|
ServiceName: "organize.MenuService",
|
||||||
HandlerType: (*MenuServiceServer)(nil),
|
HandlerType: (*MenuServiceServer)(nil),
|
||||||
Methods: []grpc.MethodDesc{
|
Methods: []grpc.MethodDesc{
|
||||||
{
|
|
||||||
MethodName: "GetMenus",
|
|
||||||
Handler: _MenuService_GetMenus_Handler,
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
MethodName: "GetMenuLevelLabels",
|
MethodName: "GetMenuLevelLabels",
|
||||||
Handler: _MenuService_GetMenuLevelLabels_Handler,
|
Handler: _MenuService_GetMenuLevelLabels_Handler,
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
// Code generated by protoc-gen-go-aeus. DO NOT EDIT.
|
// Code generated by protoc-gen-go-aeus. DO NOT EDIT.
|
||||||
// source: organize.proto
|
// source: organize.proto
|
||||||
// date: 2025-06-22 11:09:05
|
// date: 2025-06-18 15:37:30
|
||||||
|
|
||||||
package pb
|
package pb
|
||||||
|
|
||||||
|
@ -11,69 +11,57 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
type UserServiceHttpServer interface {
|
type UserServiceHttpServer interface {
|
||||||
|
GetMenus(context.Context, *GetMenuRequest) (*GetMenuResponse, error)
|
||||||
|
|
||||||
// 获取用户菜单
|
GetProfile(context.Context, *GetProfileRequest) (*GetProfileResponse, error)
|
||||||
GetMenus(ctx context.Context, req *GetUserMenuRequest) (res *GetUserMenuResponse, err error)
|
|
||||||
|
|
||||||
// 获取用户信息
|
UpdateProfile(context.Context, *UpdateProfileRequest) (*UpdateProfileResponse, error)
|
||||||
GetProfile(ctx context.Context, req *GetProfileRequest) (res *GetProfileResponse, err error)
|
|
||||||
|
|
||||||
// 更新用户信息
|
ResetPassword(context.Context, *ResetPasswordRequest) (*ResetPasswordResponse, error)
|
||||||
UpdateProfile(ctx context.Context, req *UpdateProfileRequest) (res *UpdateProfileResponse, err error)
|
|
||||||
|
|
||||||
// 重置用户密码
|
GetPermissions(context.Context, *GetPermissionRequest) (*GetPermissionResponse, error)
|
||||||
ResetPassword(ctx context.Context, req *ResetPasswordRequest) (res *ResetPasswordResponse, err error)
|
|
||||||
|
|
||||||
// 获取用户权限
|
GetUserLabels(context.Context, *GetUserLabelRequest) (*GetUserLabelResponse, error)
|
||||||
GetPermissions(ctx context.Context, req *GetPermissionRequest) (res *GetPermissionResponse, err error)
|
|
||||||
|
|
||||||
// 获取用户标签
|
GetUserTags(context.Context, *GetUserTagRequest) (*GetUserTagResponse, error)
|
||||||
GetUserLabels(ctx context.Context, req *GetUserLabelRequest) (res *GetUserLabelResponse, err error)
|
|
||||||
|
|
||||||
// 获取用户标签
|
|
||||||
GetUserTags(ctx context.Context, req *GetUserTagRequest) (res *GetUserTagResponse, err error)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type DepartmentServiceHttpServer interface {
|
type DepartmentServiceHttpServer interface {
|
||||||
|
GetDepartmentLabels(context.Context, *GetDepartmentLabelRequest) (*GetDepartmentLabelResponse, error)
|
||||||
|
|
||||||
// 获取部门标签
|
GetDepartmentUsers(context.Context, *GetDepartmentUserRequest) (*GetDepartmentUserResponse, error)
|
||||||
GetDepartmentLabels(ctx context.Context, req *GetDepartmentLabelRequest) (res *GetDepartmentLabelResponse, err error)
|
|
||||||
|
|
||||||
GetDepartmentUsers(ctx context.Context, req *GetDepartmentUserRequest) (res *GetDepartmentUserResponse, err error)
|
GetDepartmentLevelLabels(context.Context, *GetDepartmentLevelLabelsRequest) (*GetDepartmentLevelLabelsResponse, error)
|
||||||
|
|
||||||
GetDepartmentLevelLabels(ctx context.Context, req *GetDepartmentLevelLabelsRequest) (res *GetDepartmentLevelLabelsResponse, err error)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type RoleServiceHttpServer interface {
|
type RoleServiceHttpServer interface {
|
||||||
|
GetRoleLabels(context.Context, *GetRoleLabelRequest) (*GetRoleLabelResponse, error)
|
||||||
|
|
||||||
// 获取角色标签
|
GetRolePermissions(context.Context, *GetRolePermissionRequest) (*GetRolePermissionResponse, error)
|
||||||
GetRoleLabels(ctx context.Context, req *GetRoleLabelRequest) (res *GetRoleLabelResponse, err error)
|
|
||||||
|
|
||||||
// 获取角色权限
|
SaveRolePermission(context.Context, *SaveRolePermissionRequest) (*SaveRolePermissionResponse, error)
|
||||||
GetRolePermissions(ctx context.Context, req *GetRolePermissionRequest) (res *GetRolePermissionResponse, err error)
|
|
||||||
|
|
||||||
SaveRolePermission(ctx context.Context, req *SaveRolePermissionRequest) (res *SaveRolePermissionResponse, err error)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type MenuServiceHttpServer interface {
|
type MenuServiceHttpServer interface {
|
||||||
GetMenus(ctx context.Context, req *GetMenuRequest) (res *GetMenuResponse, err error)
|
GetMenuLevelLabels(context.Context, *GetMenuLevelLabelsRequest) (*GetMenuLevelLabelsResponse, error)
|
||||||
|
|
||||||
GetMenuLevelLabels(ctx context.Context, req *GetMenuLevelLabelsRequest) (res *GetMenuLevelLabelsResponse, err error)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type AuthServiceHttpServer interface {
|
type AuthServiceHttpServer interface {
|
||||||
Login(ctx context.Context, req *LoginRequest) (res *LoginResponse, err error)
|
Login(context.Context, *LoginRequest) (*LoginResponse, error)
|
||||||
|
|
||||||
Logout(ctx context.Context, req *LogoutRequest) (res *LogoutResponse, err error)
|
Logout(context.Context, *LogoutRequest) (*LogoutResponse, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取用户菜单
|
// 获取用户菜单
|
||||||
|
|
||||||
func handleUserServiceGetMenus(s UserServiceHttpServer) http.HandleFunc {
|
func handleUserServiceGetMenus(s UserServiceHttpServer) http.HandleFunc {
|
||||||
return func(ctx *http.Context) (err error) {
|
return func(ctx *http.Context) (err error) {
|
||||||
req := &GetUserMenuRequest{}
|
req := &GetMenuRequest{}
|
||||||
|
|
||||||
if err := ctx.Bind(req); err != nil {
|
if err := ctx.Bind(req); err != nil {
|
||||||
return ctx.Error(errors.Invalid, err.Error())
|
return ctx.Error(errors.Invalid, err.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
if res, err := s.GetMenus(ctx.Context(), req); err != nil {
|
if res, err := s.GetMenus(ctx.Context(), req); err != nil {
|
||||||
if er, ok := err.(*errors.Error); ok {
|
if er, ok := err.(*errors.Error); ok {
|
||||||
return ctx.Error(er.Code, er.Message)
|
return ctx.Error(er.Code, er.Message)
|
||||||
|
@ -87,12 +75,15 @@ func handleUserServiceGetMenus(s UserServiceHttpServer) http.HandleFunc {
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取用户信息
|
// 获取用户信息
|
||||||
|
|
||||||
func handleUserServiceGetProfile(s UserServiceHttpServer) http.HandleFunc {
|
func handleUserServiceGetProfile(s UserServiceHttpServer) http.HandleFunc {
|
||||||
return func(ctx *http.Context) (err error) {
|
return func(ctx *http.Context) (err error) {
|
||||||
req := &GetProfileRequest{}
|
req := &GetProfileRequest{}
|
||||||
|
|
||||||
if err := ctx.Bind(req); err != nil {
|
if err := ctx.Bind(req); err != nil {
|
||||||
return ctx.Error(errors.Invalid, err.Error())
|
return ctx.Error(errors.Invalid, err.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
if res, err := s.GetProfile(ctx.Context(), req); err != nil {
|
if res, err := s.GetProfile(ctx.Context(), req); err != nil {
|
||||||
if er, ok := err.(*errors.Error); ok {
|
if er, ok := err.(*errors.Error); ok {
|
||||||
return ctx.Error(er.Code, er.Message)
|
return ctx.Error(er.Code, er.Message)
|
||||||
|
@ -106,12 +97,15 @@ func handleUserServiceGetProfile(s UserServiceHttpServer) http.HandleFunc {
|
||||||
}
|
}
|
||||||
|
|
||||||
// 更新用户信息
|
// 更新用户信息
|
||||||
|
|
||||||
func handleUserServiceUpdateProfile(s UserServiceHttpServer) http.HandleFunc {
|
func handleUserServiceUpdateProfile(s UserServiceHttpServer) http.HandleFunc {
|
||||||
return func(ctx *http.Context) (err error) {
|
return func(ctx *http.Context) (err error) {
|
||||||
req := &UpdateProfileRequest{}
|
req := &UpdateProfileRequest{}
|
||||||
|
|
||||||
if err := ctx.Bind(req); err != nil {
|
if err := ctx.Bind(req); err != nil {
|
||||||
return ctx.Error(errors.Invalid, err.Error())
|
return ctx.Error(errors.Invalid, err.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
if res, err := s.UpdateProfile(ctx.Context(), req); err != nil {
|
if res, err := s.UpdateProfile(ctx.Context(), req); err != nil {
|
||||||
if er, ok := err.(*errors.Error); ok {
|
if er, ok := err.(*errors.Error); ok {
|
||||||
return ctx.Error(er.Code, er.Message)
|
return ctx.Error(er.Code, er.Message)
|
||||||
|
@ -125,12 +119,15 @@ func handleUserServiceUpdateProfile(s UserServiceHttpServer) http.HandleFunc {
|
||||||
}
|
}
|
||||||
|
|
||||||
// 重置用户密码
|
// 重置用户密码
|
||||||
|
|
||||||
func handleUserServiceResetPassword(s UserServiceHttpServer) http.HandleFunc {
|
func handleUserServiceResetPassword(s UserServiceHttpServer) http.HandleFunc {
|
||||||
return func(ctx *http.Context) (err error) {
|
return func(ctx *http.Context) (err error) {
|
||||||
req := &ResetPasswordRequest{}
|
req := &ResetPasswordRequest{}
|
||||||
|
|
||||||
if err := ctx.Bind(req); err != nil {
|
if err := ctx.Bind(req); err != nil {
|
||||||
return ctx.Error(errors.Invalid, err.Error())
|
return ctx.Error(errors.Invalid, err.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
if res, err := s.ResetPassword(ctx.Context(), req); err != nil {
|
if res, err := s.ResetPassword(ctx.Context(), req); err != nil {
|
||||||
if er, ok := err.(*errors.Error); ok {
|
if er, ok := err.(*errors.Error); ok {
|
||||||
return ctx.Error(er.Code, er.Message)
|
return ctx.Error(er.Code, er.Message)
|
||||||
|
@ -144,12 +141,15 @@ func handleUserServiceResetPassword(s UserServiceHttpServer) http.HandleFunc {
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取用户权限
|
// 获取用户权限
|
||||||
|
|
||||||
func handleUserServiceGetPermissions(s UserServiceHttpServer) http.HandleFunc {
|
func handleUserServiceGetPermissions(s UserServiceHttpServer) http.HandleFunc {
|
||||||
return func(ctx *http.Context) (err error) {
|
return func(ctx *http.Context) (err error) {
|
||||||
req := &GetPermissionRequest{}
|
req := &GetPermissionRequest{}
|
||||||
|
|
||||||
if err := ctx.Bind(req); err != nil {
|
if err := ctx.Bind(req); err != nil {
|
||||||
return ctx.Error(errors.Invalid, err.Error())
|
return ctx.Error(errors.Invalid, err.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
if res, err := s.GetPermissions(ctx.Context(), req); err != nil {
|
if res, err := s.GetPermissions(ctx.Context(), req); err != nil {
|
||||||
if er, ok := err.(*errors.Error); ok {
|
if er, ok := err.(*errors.Error); ok {
|
||||||
return ctx.Error(er.Code, er.Message)
|
return ctx.Error(er.Code, er.Message)
|
||||||
|
@ -163,6 +163,7 @@ func handleUserServiceGetPermissions(s UserServiceHttpServer) http.HandleFunc {
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取用户标签
|
// 获取用户标签
|
||||||
|
|
||||||
func handleUserServiceGetUserLabels(s UserServiceHttpServer) http.HandleFunc {
|
func handleUserServiceGetUserLabels(s UserServiceHttpServer) http.HandleFunc {
|
||||||
return func(ctx *http.Context) (err error) {
|
return func(ctx *http.Context) (err error) {
|
||||||
req := &GetUserLabelRequest{}
|
req := &GetUserLabelRequest{}
|
||||||
|
@ -180,6 +181,7 @@ func handleUserServiceGetUserLabels(s UserServiceHttpServer) http.HandleFunc {
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取用户标签
|
// 获取用户标签
|
||||||
|
|
||||||
func handleUserServiceGetUserTags(s UserServiceHttpServer) http.HandleFunc {
|
func handleUserServiceGetUserTags(s UserServiceHttpServer) http.HandleFunc {
|
||||||
return func(ctx *http.Context) (err error) {
|
return func(ctx *http.Context) (err error) {
|
||||||
req := &GetUserTagRequest{}
|
req := &GetUserTagRequest{}
|
||||||
|
@ -197,6 +199,7 @@ func handleUserServiceGetUserTags(s UserServiceHttpServer) http.HandleFunc {
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取部门标签
|
// 获取部门标签
|
||||||
|
|
||||||
func handleDepartmentServiceGetDepartmentLabels(s DepartmentServiceHttpServer) http.HandleFunc {
|
func handleDepartmentServiceGetDepartmentLabels(s DepartmentServiceHttpServer) http.HandleFunc {
|
||||||
return func(ctx *http.Context) (err error) {
|
return func(ctx *http.Context) (err error) {
|
||||||
req := &GetDepartmentLabelRequest{}
|
req := &GetDepartmentLabelRequest{}
|
||||||
|
@ -246,6 +249,7 @@ func handleDepartmentServiceGetDepartmentLevelLabels(s DepartmentServiceHttpServ
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取角色标签
|
// 获取角色标签
|
||||||
|
|
||||||
func handleRoleServiceGetRoleLabels(s RoleServiceHttpServer) http.HandleFunc {
|
func handleRoleServiceGetRoleLabels(s RoleServiceHttpServer) http.HandleFunc {
|
||||||
return func(ctx *http.Context) (err error) {
|
return func(ctx *http.Context) (err error) {
|
||||||
req := &GetRoleLabelRequest{}
|
req := &GetRoleLabelRequest{}
|
||||||
|
@ -263,12 +267,15 @@ func handleRoleServiceGetRoleLabels(s RoleServiceHttpServer) http.HandleFunc {
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取角色权限
|
// 获取角色权限
|
||||||
|
|
||||||
func handleRoleServiceGetRolePermissions(s RoleServiceHttpServer) http.HandleFunc {
|
func handleRoleServiceGetRolePermissions(s RoleServiceHttpServer) http.HandleFunc {
|
||||||
return func(ctx *http.Context) (err error) {
|
return func(ctx *http.Context) (err error) {
|
||||||
req := &GetRolePermissionRequest{}
|
req := &GetRolePermissionRequest{}
|
||||||
|
|
||||||
if err := ctx.Bind(req); err != nil {
|
if err := ctx.Bind(req); err != nil {
|
||||||
return ctx.Error(errors.Invalid, err.Error())
|
return ctx.Error(errors.Invalid, err.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
if res, err := s.GetRolePermissions(ctx.Context(), req); err != nil {
|
if res, err := s.GetRolePermissions(ctx.Context(), req); err != nil {
|
||||||
if er, ok := err.(*errors.Error); ok {
|
if er, ok := err.(*errors.Error); ok {
|
||||||
return ctx.Error(er.Code, er.Message)
|
return ctx.Error(er.Code, er.Message)
|
||||||
|
@ -284,9 +291,11 @@ func handleRoleServiceGetRolePermissions(s RoleServiceHttpServer) http.HandleFun
|
||||||
func handleRoleServiceSaveRolePermission(s RoleServiceHttpServer) http.HandleFunc {
|
func handleRoleServiceSaveRolePermission(s RoleServiceHttpServer) http.HandleFunc {
|
||||||
return func(ctx *http.Context) (err error) {
|
return func(ctx *http.Context) (err error) {
|
||||||
req := &SaveRolePermissionRequest{}
|
req := &SaveRolePermissionRequest{}
|
||||||
|
|
||||||
if err := ctx.Bind(req); err != nil {
|
if err := ctx.Bind(req); err != nil {
|
||||||
return ctx.Error(errors.Invalid, err.Error())
|
return ctx.Error(errors.Invalid, err.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
if res, err := s.SaveRolePermission(ctx.Context(), req); err != nil {
|
if res, err := s.SaveRolePermission(ctx.Context(), req); err != nil {
|
||||||
if er, ok := err.(*errors.Error); ok {
|
if er, ok := err.(*errors.Error); ok {
|
||||||
return ctx.Error(er.Code, er.Message)
|
return ctx.Error(er.Code, er.Message)
|
||||||
|
@ -299,22 +308,6 @@ func handleRoleServiceSaveRolePermission(s RoleServiceHttpServer) http.HandleFun
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func handleMenuServiceGetMenus(s MenuServiceHttpServer) http.HandleFunc {
|
|
||||||
return func(ctx *http.Context) (err error) {
|
|
||||||
req := &GetMenuRequest{}
|
|
||||||
|
|
||||||
if res, err := s.GetMenus(ctx.Context(), req); err != nil {
|
|
||||||
if er, ok := err.(*errors.Error); ok {
|
|
||||||
return ctx.Error(er.Code, er.Message)
|
|
||||||
} else {
|
|
||||||
return ctx.Error(errors.Unavailable, err.Error())
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return ctx.Success(res)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func handleMenuServiceGetMenuLevelLabels(s MenuServiceHttpServer) http.HandleFunc {
|
func handleMenuServiceGetMenuLevelLabels(s MenuServiceHttpServer) http.HandleFunc {
|
||||||
return func(ctx *http.Context) (err error) {
|
return func(ctx *http.Context) (err error) {
|
||||||
req := &GetMenuLevelLabelsRequest{}
|
req := &GetMenuLevelLabelsRequest{}
|
||||||
|
@ -334,9 +327,11 @@ func handleMenuServiceGetMenuLevelLabels(s MenuServiceHttpServer) http.HandleFun
|
||||||
func handleAuthServiceLogin(s AuthServiceHttpServer) http.HandleFunc {
|
func handleAuthServiceLogin(s AuthServiceHttpServer) http.HandleFunc {
|
||||||
return func(ctx *http.Context) (err error) {
|
return func(ctx *http.Context) (err error) {
|
||||||
req := &LoginRequest{}
|
req := &LoginRequest{}
|
||||||
|
|
||||||
if err := ctx.Bind(req); err != nil {
|
if err := ctx.Bind(req); err != nil {
|
||||||
return ctx.Error(errors.Invalid, err.Error())
|
return ctx.Error(errors.Invalid, err.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
if res, err := s.Login(ctx.Context(), req); err != nil {
|
if res, err := s.Login(ctx.Context(), req); err != nil {
|
||||||
if er, ok := err.(*errors.Error); ok {
|
if er, ok := err.(*errors.Error); ok {
|
||||||
return ctx.Error(er.Code, er.Message)
|
return ctx.Error(er.Code, er.Message)
|
||||||
|
@ -352,9 +347,11 @@ func handleAuthServiceLogin(s AuthServiceHttpServer) http.HandleFunc {
|
||||||
func handleAuthServiceLogout(s AuthServiceHttpServer) http.HandleFunc {
|
func handleAuthServiceLogout(s AuthServiceHttpServer) http.HandleFunc {
|
||||||
return func(ctx *http.Context) (err error) {
|
return func(ctx *http.Context) (err error) {
|
||||||
req := &LogoutRequest{}
|
req := &LogoutRequest{}
|
||||||
|
|
||||||
if err := ctx.Bind(req); err != nil {
|
if err := ctx.Bind(req); err != nil {
|
||||||
return ctx.Error(errors.Invalid, err.Error())
|
return ctx.Error(errors.Invalid, err.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
if res, err := s.Logout(ctx.Context(), req); err != nil {
|
if res, err := s.Logout(ctx.Context(), req); err != nil {
|
||||||
if er, ok := err.(*errors.Error); ok {
|
if er, ok := err.(*errors.Error); ok {
|
||||||
return ctx.Error(er.Code, er.Message)
|
return ctx.Error(er.Code, er.Message)
|
||||||
|
@ -420,9 +417,6 @@ func RegisterRoleServiceRouter(hs *http.Server, s RoleServiceHttpServer) {
|
||||||
|
|
||||||
func RegisterMenuServiceRouter(hs *http.Server, s MenuServiceHttpServer) {
|
func RegisterMenuServiceRouter(hs *http.Server, s MenuServiceHttpServer) {
|
||||||
|
|
||||||
// Register handle GetMenus route
|
|
||||||
hs.GET("/menu/list", handleMenuServiceGetMenus(s))
|
|
||||||
|
|
||||||
// Register handle GetMenuLevelLabels route
|
// Register handle GetMenuLevelLabels route
|
||||||
hs.GET("/menu/level-labels", handleMenuServiceGetMenuLevelLabels(s))
|
hs.GET("/menu/level-labels", handleMenuServiceGetMenuLevelLabels(s))
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
// Code generated by protoc-gen-go-aeus. DO NOT EDIT.
|
// Code generated by protoc-gen-go-aeus. DO NOT EDIT.
|
||||||
// source: organize.proto
|
// source: organize.proto
|
||||||
// date: 2025-06-22 11:09:05
|
// date: 2025-06-18 15:37:30
|
||||||
|
|
||||||
package pb
|
package pb
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@ type MenuModel struct {
|
||||||
Id int64 `json:"id" yaml:"id" xml:"id" gorm:"primaryKey;column:id" comment:"菜单ID"`
|
Id int64 `json:"id" yaml:"id" xml:"id" gorm:"primaryKey;column:id" comment:"菜单ID"`
|
||||||
CreatedAt int64 `json:"created_at" yaml:"createdAt" xml:"createdAt" gorm:"column:created_at" comment:"创建时间" scenarios:"view;export"`
|
CreatedAt int64 `json:"created_at" yaml:"createdAt" xml:"createdAt" gorm:"column:created_at" comment:"创建时间" scenarios:"view;export"`
|
||||||
UpdatedAt int64 `json:"updated_at" yaml:"updatedAt" xml:"updatedAt" gorm:"index;column:updated_at" comment:"更新时间" scenarios:"view;export"`
|
UpdatedAt int64 `json:"updated_at" yaml:"updatedAt" xml:"updatedAt" gorm:"index;column:updated_at" comment:"更新时间" scenarios:"view;export"`
|
||||||
Parent string `json:"parent" yaml:"parent" xml:"parent" gorm:"index;size:60;column:parent" comment:"父级菜单" scenarios:"create;update;view;export" format:"menu" props:"readonly:update" live:"type:dropdown;url:/menu/level-labels"`
|
Parent string `json:"parent" yaml:"parent" xml:"parent" gorm:"index;size:60;column:parent" comment:"父级菜单" format:"menu" props:"readonly:update" live:"type:dropdown;url:/menu/level-labels"`
|
||||||
Name string `json:"name" yaml:"name" xml:"name" gorm:"index;size:60;column:name" comment:"组件名称" props:"readonly:update" rule:"unique;required"`
|
Name string `json:"name" yaml:"name" xml:"name" gorm:"index;size:60;column:name" comment:"组件名称" props:"readonly:update" rule:"unique;required"`
|
||||||
Label string `json:"label" yaml:"label" xml:"label" gorm:"size:120;column:label" comment:"菜单标题" rule:"required"`
|
Label string `json:"label" yaml:"label" xml:"label" gorm:"size:120;column:label" comment:"菜单标题" rule:"required"`
|
||||||
Uri string `json:"uri" yaml:"uri" xml:"uri" gorm:"size:512;column:uri" comment:"菜单链接" scenarios:"create;update;view;export" rule:"required"`
|
Uri string `json:"uri" yaml:"uri" xml:"uri" gorm:"size:512;column:uri" comment:"菜单链接" scenarios:"create;update;view;export" rule:"required"`
|
||||||
|
@ -20,7 +20,7 @@ type MenuModel struct {
|
||||||
Icon string `json:"icon" yaml:"icon" xml:"icon" gorm:"size:60;column:icon" comment:"菜单图标" scenarios:"create;update;view;export"`
|
Icon string `json:"icon" yaml:"icon" xml:"icon" gorm:"size:60;column:icon" comment:"菜单图标" scenarios:"create;update;view;export"`
|
||||||
Hidden bool `json:"hidden" yaml:"hidden" xml:"hidden" gorm:"column:hidden" comment:"是否隐藏" scenarios:"create;update;view;export"`
|
Hidden bool `json:"hidden" yaml:"hidden" xml:"hidden" gorm:"column:hidden" comment:"是否隐藏" scenarios:"create;update;view;export"`
|
||||||
Public bool `json:"public" yaml:"public" xml:"public" gorm:"column:public" comment:"是否公开" scenarios:"create;update;view;export"`
|
Public bool `json:"public" yaml:"public" xml:"public" gorm:"column:public" comment:"是否公开" scenarios:"create;update;view;export"`
|
||||||
Description string `json:"description" yaml:"description" xml:"description" gorm:"size:1024;column:description" comment:"备注说明" scenarios:"create;update;view;export" format:"textarea"`
|
Description string `json:"description" yaml:"description" xml:"description" gorm:"size:1024;column:description" comment:"备注说明" scenarios:"create;update;view;export;list" format:"textarea"`
|
||||||
Position int64 `json:"position" yaml:"position" xml:"position" gorm:"column:position" comment:"排序" scenarios:"create;update"`
|
Position int64 `json:"position" yaml:"position" xml:"position" gorm:"column:position" comment:"排序" scenarios:"create;update"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -98,8 +98,8 @@ type RoleModel struct {
|
||||||
Id int64 `json:"id" yaml:"id" xml:"id" gorm:"primaryKey;column:id" comment:"角色ID"`
|
Id int64 `json:"id" yaml:"id" xml:"id" gorm:"primaryKey;column:id" comment:"角色ID"`
|
||||||
CreatedAt int64 `json:"created_at" yaml:"createdAt" xml:"createdAt" gorm:"column:created_at" comment:"创建时间" scenarios:"view;export"`
|
CreatedAt int64 `json:"created_at" yaml:"createdAt" xml:"createdAt" gorm:"column:created_at" comment:"创建时间" scenarios:"view;export"`
|
||||||
UpdatedAt int64 `json:"updated_at" yaml:"updatedAt" xml:"updatedAt" gorm:"index;column:updated_at" comment:"更新时间" scenarios:"view;export"`
|
UpdatedAt int64 `json:"updated_at" yaml:"updatedAt" xml:"updatedAt" gorm:"index;column:updated_at" comment:"更新时间" scenarios:"view;export"`
|
||||||
Name string `json:"name" yaml:"name" xml:"name" gorm:"index;size:60;column:name" comment:"角色名称" props:"readonly:update" rule:"required"`
|
Name string `json:"name" yaml:"name" xml:"name" gorm:"index;size:60;column:name" comment:"角色名称" props:"readonly:update"`
|
||||||
Label string `json:"label" yaml:"label" xml:"label" gorm:"size:60;column:label" comment:"角色标题" rule:"required"`
|
Label string `json:"label" yaml:"label" xml:"label" gorm:"size:60;column:label" comment:"角色标题"`
|
||||||
Description string `json:"description" yaml:"description" xml:"description" gorm:"size:1024;column:description" comment:"备注说明" scenarios:"list;create;update;export" format:"textarea"`
|
Description string `json:"description" yaml:"description" xml:"description" gorm:"size:1024;column:description" comment:"备注说明" scenarios:"list;create;update;export" format:"textarea"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -355,7 +355,7 @@ const file_system_proto_rawDesc = "" +
|
||||||
"\vdescription\x18\x06 \x01(\tBJ\xfaB\x05r\x03\x18\x80\b\xb2\xb9\x19>\n" +
|
"\vdescription\x18\x06 \x01(\tBJ\xfaB\x05r\x03\x18\x80\b\xb2\xb9\x19>\n" +
|
||||||
"\tsize:1024\x12\f备注说明\x1a\x19create;update;view;export*\btextareaR\vdescription:\x0e\xba\xb9\x19\n" +
|
"\tsize:1024\x12\f备注说明\x1a\x19create;update;view;export*\btextareaR\vdescription:\x0e\xba\xb9\x19\n" +
|
||||||
"\n" +
|
"\n" +
|
||||||
"\bsettings\"\xe2\x05\n" +
|
"\bsettings\"\xd8\x05\n" +
|
||||||
"\bActivity\x12$\n" +
|
"\bActivity\x12$\n" +
|
||||||
"\x02id\x18\x01 \x01(\x03B\x14\xb2\xb9\x19\x10\n" +
|
"\x02id\x18\x01 \x01(\x03B\x14\xb2\xb9\x19\x10\n" +
|
||||||
"\n" +
|
"\n" +
|
||||||
|
@ -363,13 +363,13 @@ const file_system_proto_rawDesc = "" +
|
||||||
"\n" +
|
"\n" +
|
||||||
"created_at\x18\x02 \x01(\x03B-\xb2\xb9\x19)\x12\f创建时间\x1a\x19search;search;view;exportR\tcreatedAt\x12W\n" +
|
"created_at\x18\x02 \x01(\x03B-\xb2\xb9\x19)\x12\f创建时间\x1a\x19search;search;view;exportR\tcreatedAt\x12W\n" +
|
||||||
"\x03uid\x18\x03 \x01(\tBE\xfaB\x06r\x04\x10\x05\x18\x14\xb2\xb9\x198\n" +
|
"\x03uid\x18\x03 \x01(\tBE\xfaB\x06r\x04\x10\x05\x18\x14\xb2\xb9\x198\n" +
|
||||||
"\rindex;size:20\x12\x06用户*\x04user2\x0freadonly:update:\brequiredR\x03uid\x12\xc9\x01\n" +
|
"\rindex;size:20\x12\x06用户*\x04user2\x0freadonly:update:\brequiredR\x03uid\x12\xbf\x01\n" +
|
||||||
"\x06action\x18\x04 \x01(\tB\xb0\x01\xb2\xb9\x19\xab\x01\n" +
|
"\x06action\x18\x04 \x01(\tB\xa6\x01\xb2\xb9\x19\xa1\x01\n" +
|
||||||
"!index;size:20;not null;default:''\x12\x06行为\x1a%search;list;create;update;view;export2\rmatch:exactly:\brequiredR>create:新建#198754;update:更新#f09d00;delete:删除#e63757R\x06action\x12h\n" +
|
"!index;size:20;not null;default:''\x12\x06行为\x1a%search;list;create;update;view;export2\rmatch:exactlyR>create:新建#198754;update:更新#f09d00;delete:删除#e63757R\x06action\x12h\n" +
|
||||||
"\x06module\x18\x05 \x01(\tBP\xb2\xb9\x19L\n" +
|
"\x06module\x18\x05 \x01(\tBP\xb2\xb9\x19L\n" +
|
||||||
"\x1bsize:60;not null;default:''\x12\x06模块\x1a%search;list;create;update;view;exportR\x06module\x12_\n" +
|
"\x1bsize:60;not null;default:''\x12\x06模块\x1a%search;list;create;update;view;exportR\x06module\x12_\n" +
|
||||||
"\x05table\x18\x06 \x01(\tBI\xb2\xb9\x19E\n" +
|
"\x05table\x18\x06 \x01(\tBI\xb2\xb9\x19E\n" +
|
||||||
"\x1bsize:60;not null;default:''\x12\x06模型\x1a\x1elist;create;update;view;exportR\x05table\x12`\n" +
|
"\x1bsize:60;not null;default:''\x12\x06数据\x1a\x1elist;create;update;view;exportR\x05table\x12`\n" +
|
||||||
"\x04data\x18\a \x01(\tBL\xb2\xb9\x19H\n" +
|
"\x04data\x18\a \x01(\tBL\xb2\xb9\x19H\n" +
|
||||||
"\x1esize:10240;not null;default:''\x12\x06内容\x1a\x1elist;create;update;view;exportR\x04data:\x10\xba\xb9\x19\f\n" +
|
"\x1esize:10240;not null;default:''\x12\x06内容\x1a\x1elist;create;update;view;exportR\x04data:\x10\xba\xb9\x19\f\n" +
|
||||||
"\n" +
|
"\n" +
|
||||||
|
|
|
@ -32,9 +32,9 @@ message Activity {
|
||||||
int64 id = 1 [(aeus.field) = {gorm:"primaryKey",comment:"ID"}];
|
int64 id = 1 [(aeus.field) = {gorm:"primaryKey",comment:"ID"}];
|
||||||
int64 created_at = 2 [(aeus.field)={scenarios:"search;search;view;export",comment:"创建时间"}];
|
int64 created_at = 2 [(aeus.field)={scenarios:"search;search;view;export",comment:"创建时间"}];
|
||||||
string uid = 3 [(aeus.field)={gorm:"index;size:20",rule:"required",props:"readonly:update",format:"user",comment: "用户"},(validate.rules).string = {min_len: 5, max_len: 20}];
|
string uid = 3 [(aeus.field)={gorm:"index;size:20",rule:"required",props:"readonly:update",format:"user",comment: "用户"},(validate.rules).string = {min_len: 5, max_len: 20}];
|
||||||
string action = 4 [(aeus.field)={props:"match:exactly",rule:"required",gorm:"index;size:20;not null;default:''",comment:"行为",enum:"create:新建#198754;update:更新#f09d00;delete:删除#e63757",scenarios:"search;list;create;update;view;export"}];
|
string action = 4 [(aeus.field)={props:"match:exactly",gorm:"index;size:20;not null;default:''",comment:"行为",enum:"create:新建#198754;update:更新#f09d00;delete:删除#e63757",scenarios:"search;list;create;update;view;export"}];
|
||||||
string module = 5 [(aeus.field)={gorm:"size:60;not null;default:''",comment:"模块",scenarios:"search;list;create;update;view;export"}];
|
string module = 5 [(aeus.field)={gorm:"size:60;not null;default:''",comment:"模块",scenarios:"search;list;create;update;view;export"}];
|
||||||
string table = 6 [(aeus.field)={gorm:"size:60;not null;default:''",comment:"模型",scenarios:"list;create;update;view;export"}];
|
string table = 6 [(aeus.field)={gorm:"size:60;not null;default:''",comment:"数据",scenarios:"list;create;update;view;export"}];
|
||||||
string data = 7 [(aeus.field)={gorm:"size:10240;not null;default:''",comment:"内容",scenarios:"list;create;update;view;export"}];
|
string data = 7 [(aeus.field)={gorm:"size:10240;not null;default:''",comment:"内容",scenarios:"list;create;update;view;export"}];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
// Code generated by protoc-gen-go-aeus. DO NOT EDIT.
|
// Code generated by protoc-gen-go-aeus. DO NOT EDIT.
|
||||||
// source: system.proto
|
// source: system.proto
|
||||||
// date: 2025-06-22 11:09:05
|
// date: 2025-06-18 15:37:30
|
||||||
|
|
||||||
package pb
|
package pb
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
type SettingServiceHttpServer interface {
|
type SettingServiceHttpServer interface {
|
||||||
GetSetting(ctx context.Context, req *GetSettingRequest) (res *GetSettingResponse, err error)
|
GetSetting(context.Context, *GetSettingRequest) (*GetSettingResponse, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
func handleSettingServiceGetSetting(s SettingServiceHttpServer) http.HandleFunc {
|
func handleSettingServiceGetSetting(s SettingServiceHttpServer) http.HandleFunc {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
// Code generated by protoc-gen-go-aeus. DO NOT EDIT.
|
// Code generated by protoc-gen-go-aeus. DO NOT EDIT.
|
||||||
// source: system.proto
|
// source: system.proto
|
||||||
// date: 2025-06-22 11:09:05
|
// date: 2025-06-18 15:37:30
|
||||||
|
|
||||||
package pb
|
package pb
|
||||||
|
|
||||||
|
@ -77,9 +77,9 @@ type ActivityModel struct {
|
||||||
Id int64 `json:"id" yaml:"id" xml:"id" gorm:"primaryKey;column:id" comment:"ID"`
|
Id int64 `json:"id" yaml:"id" xml:"id" gorm:"primaryKey;column:id" comment:"ID"`
|
||||||
CreatedAt int64 `json:"created_at" yaml:"createdAt" xml:"createdAt" gorm:"column:created_at" comment:"创建时间" scenarios:"search;search;view;export"`
|
CreatedAt int64 `json:"created_at" yaml:"createdAt" xml:"createdAt" gorm:"column:created_at" comment:"创建时间" scenarios:"search;search;view;export"`
|
||||||
Uid string `json:"uid" yaml:"uid" xml:"uid" gorm:"index;size:20;column:uid" comment:"用户" format:"user" props:"readonly:update" rule:"required"`
|
Uid string `json:"uid" yaml:"uid" xml:"uid" gorm:"index;size:20;column:uid" comment:"用户" format:"user" props:"readonly:update" rule:"required"`
|
||||||
Action string `json:"action" yaml:"action" xml:"action" gorm:"index;size:20;not null;default:'';column:action" comment:"行为" scenarios:"search;list;create;update;view;export" props:"match:exactly" rule:"required" enum:"create:新建#198754;update:更新#f09d00;delete:删除#e63757"`
|
Action string `json:"action" yaml:"action" xml:"action" gorm:"index;size:20;not null;default:'';column:action" comment:"行为" scenarios:"search;list;create;update;view;export" props:"match:exactly" enum:"create:新建#198754;update:更新#f09d00;delete:删除#e63757"`
|
||||||
Module string `json:"module" yaml:"module" xml:"module" gorm:"size:60;not null;default:'';column:module" comment:"模块" scenarios:"search;list;create;update;view;export"`
|
Module string `json:"module" yaml:"module" xml:"module" gorm:"size:60;not null;default:'';column:module" comment:"模块" scenarios:"search;list;create;update;view;export"`
|
||||||
Table string `json:"table" yaml:"table" xml:"table" gorm:"size:60;not null;default:'';column:table" comment:"模型" scenarios:"list;create;update;view;export"`
|
Table string `json:"table" yaml:"table" xml:"table" gorm:"size:60;not null;default:'';column:table" comment:"数据" scenarios:"list;create;update;view;export"`
|
||||||
Data string `json:"data" yaml:"data" xml:"data" gorm:"size:10240;not null;default:'';column:data" comment:"内容" scenarios:"list;create;update;view;export"`
|
Data string `json:"data" yaml:"data" xml:"data" gorm:"size:10240;not null;default:'';column:data" comment:"内容" scenarios:"list;create;update;view;export"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,8 +5,6 @@ import (
|
||||||
"slices"
|
"slices"
|
||||||
|
|
||||||
"git.nobla.cn/golang/aeus-admin/internal/logic"
|
"git.nobla.cn/golang/aeus-admin/internal/logic"
|
||||||
"git.nobla.cn/golang/aeus-admin/models"
|
|
||||||
"git.nobla.cn/golang/aeus-admin/types"
|
|
||||||
"git.nobla.cn/golang/aeus/middleware/auth"
|
"git.nobla.cn/golang/aeus/middleware/auth"
|
||||||
"git.nobla.cn/golang/aeus/pkg/cache"
|
"git.nobla.cn/golang/aeus/pkg/cache"
|
||||||
"git.nobla.cn/golang/aeus/pkg/errors"
|
"git.nobla.cn/golang/aeus/pkg/errors"
|
||||||
|
@ -15,8 +13,7 @@ import (
|
||||||
|
|
||||||
type PermissionChecker struct {
|
type PermissionChecker struct {
|
||||||
db *gorm.DB
|
db *gorm.DB
|
||||||
user *logic.User
|
logic *logic.User
|
||||||
role *logic.Role
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *PermissionChecker) CheckPermission(ctx context.Context, permission string) (err error) {
|
func (p *PermissionChecker) CheckPermission(ctx context.Context, permission string) (err error) {
|
||||||
|
@ -24,30 +21,14 @@ func (p *PermissionChecker) CheckPermission(ctx context.Context, permission stri
|
||||||
uid string
|
uid string
|
||||||
ps []string
|
ps []string
|
||||||
)
|
)
|
||||||
claims, ok := auth.FromContext(ctx)
|
if claims, ok := auth.FromContext(ctx); !ok {
|
||||||
if !ok {
|
|
||||||
return errors.ErrAccessDenied
|
return errors.ErrAccessDenied
|
||||||
}
|
|
||||||
if cl, ok := claims.(*types.Claims); ok {
|
|
||||||
if cl.Admin {
|
|
||||||
return
|
|
||||||
} else {
|
} else {
|
||||||
var pms []*models.Permission
|
|
||||||
if pms, err = p.role.GetPermissions(ctx, cl.Role); err == nil {
|
|
||||||
for _, pm := range pms {
|
|
||||||
if pm.Permission == permission {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return errors.ErrPermissionDenied
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if uid, err = claims.GetSubject(); err != nil {
|
if uid, err = claims.GetSubject(); err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if ps, err = p.user.GetPermissions(ctx, uid); err != nil {
|
}
|
||||||
|
if ps, err = p.logic.GetPermissions(ctx, uid); err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if !slices.Contains(ps, permission) {
|
if !slices.Contains(ps, permission) {
|
||||||
|
@ -59,7 +40,6 @@ func (p *PermissionChecker) CheckPermission(ctx context.Context, permission stri
|
||||||
func NewPermissionChecker(db *gorm.DB, ch cache.Cache) *PermissionChecker {
|
func NewPermissionChecker(db *gorm.DB, ch cache.Cache) *PermissionChecker {
|
||||||
return &PermissionChecker{
|
return &PermissionChecker{
|
||||||
db: db,
|
db: db,
|
||||||
user: logic.NewUserLogic(db, ch),
|
logic: logic.NewUserLogic(db, ch),
|
||||||
role: logic.NewRoleLogic(db, ch),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,30 +0,0 @@
|
||||||
package cfgload
|
|
||||||
|
|
||||||
import (
|
|
||||||
"encoding/json"
|
|
||||||
"encoding/xml"
|
|
||||||
"os"
|
|
||||||
"path"
|
|
||||||
|
|
||||||
"gopkg.in/yaml.v3"
|
|
||||||
)
|
|
||||||
|
|
||||||
// FromFile loads configuration from file
|
|
||||||
func FromFile(filepath string, cfg any) (err error) {
|
|
||||||
var (
|
|
||||||
buf []byte
|
|
||||||
)
|
|
||||||
if buf, err = os.ReadFile(filepath); err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
ext := path.Ext(filepath)
|
|
||||||
switch ext {
|
|
||||||
case ".json":
|
|
||||||
err = json.Unmarshal(buf, cfg)
|
|
||||||
case ".xml":
|
|
||||||
err = xml.Unmarshal(buf, cfg)
|
|
||||||
case ".yaml", ".yml":
|
|
||||||
err = yaml.Unmarshal(buf, cfg)
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
|
@ -1,78 +0,0 @@
|
||||||
package chartjs
|
|
||||||
|
|
||||||
import (
|
|
||||||
"slices"
|
|
||||||
"sync"
|
|
||||||
)
|
|
||||||
|
|
||||||
// DataCounter 计数统计, 实现类似Pie 和 Doughnut 之类的图形
|
|
||||||
type DataCounter struct {
|
|
||||||
mutex sync.Mutex
|
|
||||||
legends map[string]*counterValue
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *DataCounter) Inc(leg string, label string, value float64) {
|
|
||||||
c.mutex.Lock()
|
|
||||||
defer c.mutex.Unlock()
|
|
||||||
v, ok := c.legends[leg]
|
|
||||||
if !ok {
|
|
||||||
v = &counterValue{
|
|
||||||
Label: leg,
|
|
||||||
Values: make(map[string]float64),
|
|
||||||
}
|
|
||||||
c.legends[leg] = v
|
|
||||||
}
|
|
||||||
v.Values[label] += value
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *DataCounter) Dec(legend string, label string, value float64) {
|
|
||||||
c.mutex.Lock()
|
|
||||||
defer c.mutex.Unlock()
|
|
||||||
v, ok := c.legends[legend]
|
|
||||||
if !ok {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if _, ok := v.Values[label]; ok {
|
|
||||||
v.Values[label] -= value
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *DataCounter) Data() *CounterData {
|
|
||||||
c.mutex.Lock()
|
|
||||||
defer c.mutex.Unlock()
|
|
||||||
data := &CounterData{
|
|
||||||
Lables: make([]string, 0, 5),
|
|
||||||
Datasets: make([]*CounterValue, 0, len(c.legends)),
|
|
||||||
}
|
|
||||||
for _, row := range c.legends {
|
|
||||||
for k, _ := range row.Values {
|
|
||||||
if !slices.Contains(data.Lables, k) {
|
|
||||||
data.Lables = append(data.Lables, k)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for _, row := range c.legends {
|
|
||||||
set := &CounterValue{
|
|
||||||
Label: row.Label,
|
|
||||||
Data: make([]float64, 0, len(data.Lables)),
|
|
||||||
}
|
|
||||||
for _, label := range data.Lables {
|
|
||||||
set.Data = append(set.Data, row.Values[label])
|
|
||||||
}
|
|
||||||
data.Datasets = append(data.Datasets, set)
|
|
||||||
}
|
|
||||||
return data
|
|
||||||
}
|
|
||||||
|
|
||||||
func NewDataCounter(legends ...string) *DataCounter {
|
|
||||||
c := &DataCounter{
|
|
||||||
legends: make(map[string]*counterValue),
|
|
||||||
}
|
|
||||||
for _, legend := range legends {
|
|
||||||
c.legends[legend] = &counterValue{
|
|
||||||
Label: legend,
|
|
||||||
Values: make(map[string]float64),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return c
|
|
||||||
}
|
|
|
@ -1,46 +0,0 @@
|
||||||
package chartjs
|
|
||||||
|
|
||||||
import "time"
|
|
||||||
|
|
||||||
// TimeSeriesGroup 时间计算数据, 实现类似以时间为维度的折线图
|
|
||||||
type TimeSeriesGroup struct {
|
|
||||||
step string
|
|
||||||
values map[string]*TimeSeries
|
|
||||||
}
|
|
||||||
|
|
||||||
func (g *TimeSeriesGroup) Inc(tm time.Time, key string, value float64) {
|
|
||||||
v, ok := g.values[key]
|
|
||||||
if !ok {
|
|
||||||
v = NewTimeSeries(g.step)
|
|
||||||
g.values[key] = v
|
|
||||||
}
|
|
||||||
v.Inc(tm, value)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (g *TimeSeriesGroup) Dec(tm time.Time, key string, value float64) {
|
|
||||||
v, ok := g.values[key]
|
|
||||||
if !ok {
|
|
||||||
v = NewTimeSeries(g.step)
|
|
||||||
g.values[key] = v
|
|
||||||
}
|
|
||||||
v.Dec(tm, value)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Data 生成chart.js 的图表dataset
|
|
||||||
func (g *TimeSeriesGroup) Data(sts, ets int64) (values []*TimeseriesData) {
|
|
||||||
for key, row := range g.values {
|
|
||||||
data := &TimeseriesData{
|
|
||||||
Label: key,
|
|
||||||
Data: row.Values(sts, ets),
|
|
||||||
}
|
|
||||||
values = append(values, data)
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
func NewTimeSeriesGroup(step string) *TimeSeriesGroup {
|
|
||||||
return &TimeSeriesGroup{
|
|
||||||
step: step,
|
|
||||||
values: make(map[string]*TimeSeries),
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,126 +0,0 @@
|
||||||
package chartjs
|
|
||||||
|
|
||||||
import (
|
|
||||||
"sync"
|
|
||||||
"time"
|
|
||||||
)
|
|
||||||
|
|
||||||
const (
|
|
||||||
Minute = "minute"
|
|
||||||
Hour = "hour"
|
|
||||||
Day = "day"
|
|
||||||
Method = "method"
|
|
||||||
)
|
|
||||||
|
|
||||||
// 时间序列值, 实现了按时间进行分组的值计算
|
|
||||||
type TimeSeries struct {
|
|
||||||
mutex sync.Mutex
|
|
||||||
step string
|
|
||||||
values []*TimeseriesValue
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *TimeSeries) cutTimeSeries(tm time.Time) int64 {
|
|
||||||
switch s.step {
|
|
||||||
case Method:
|
|
||||||
return time.Date(tm.Year(), tm.Month(), 0, 0, 0, 0, 0, time.Local).Unix()
|
|
||||||
case Day:
|
|
||||||
return time.Date(tm.Year(), tm.Month(), tm.Day(), 0, 0, 0, 0, time.Local).Unix()
|
|
||||||
case Hour:
|
|
||||||
return time.Date(tm.Year(), tm.Month(), tm.Day(), tm.Hour(), 0, 0, 0, time.Local).Unix()
|
|
||||||
default:
|
|
||||||
return time.Date(tm.Year(), tm.Month(), tm.Day(), tm.Hour(), tm.Minute(), 0, 0, time.Local).Unix()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *TimeSeries) truncateTime(ts int64) int64 {
|
|
||||||
tm := time.Unix(ts, 0)
|
|
||||||
switch s.step {
|
|
||||||
case Method:
|
|
||||||
return time.Date(tm.Year(), tm.Month(), 0, 0, 0, 0, 0, time.Local).Unix()
|
|
||||||
case Day:
|
|
||||||
return time.Date(tm.Year(), tm.Month(), tm.Day(), 0, 0, 0, 0, time.Local).Unix()
|
|
||||||
case Hour:
|
|
||||||
return time.Date(tm.Year(), tm.Month(), tm.Day(), tm.Hour(), 0, 0, 0, time.Local).Unix()
|
|
||||||
default:
|
|
||||||
return time.Date(tm.Year(), tm.Month(), tm.Day(), tm.Hour(), tm.Minute(), 0, 0, time.Local).Unix()
|
|
||||||
}
|
|
||||||
return tm.Unix()
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *TimeSeries) nextTimestamp(ts int64) int64 {
|
|
||||||
tm := time.Unix(ts, 0)
|
|
||||||
switch s.step {
|
|
||||||
case Method:
|
|
||||||
return tm.AddDate(0, 1, 0).Unix()
|
|
||||||
case Day:
|
|
||||||
return tm.AddDate(0, 0, 1).Unix()
|
|
||||||
case Hour:
|
|
||||||
return ts + 3600
|
|
||||||
default:
|
|
||||||
return ts + 60
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *TimeSeries) Inc(tm time.Time, value float64) {
|
|
||||||
s.mutex.Lock()
|
|
||||||
defer s.mutex.Unlock()
|
|
||||||
ts := s.cutTimeSeries(tm)
|
|
||||||
for _, v := range s.values {
|
|
||||||
if v.Timestamp == ts {
|
|
||||||
v.Value += value
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
s.values = append(s.values, &TimeseriesValue{
|
|
||||||
Timestamp: ts,
|
|
||||||
Value: value,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *TimeSeries) Dec(tm time.Time, value float64) {
|
|
||||||
s.mutex.Lock()
|
|
||||||
defer s.mutex.Unlock()
|
|
||||||
ts := s.cutTimeSeries(tm)
|
|
||||||
for _, v := range s.values {
|
|
||||||
if v.Timestamp == ts {
|
|
||||||
v.Value -= value
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *TimeSeries) Values(sts, ets int64) []*TimeseriesValue {
|
|
||||||
var (
|
|
||||||
nextStamp int64
|
|
||||||
)
|
|
||||||
sts = s.truncateTime(sts)
|
|
||||||
ets = s.truncateTime(ets)
|
|
||||||
series := make([]*TimeseriesValue, 0, len(s.values))
|
|
||||||
nextStamp = sts
|
|
||||||
for _, row := range s.values {
|
|
||||||
for row.Timestamp > nextStamp {
|
|
||||||
series = append(series, &TimeseriesValue{
|
|
||||||
Timestamp: nextStamp,
|
|
||||||
Value: 0,
|
|
||||||
})
|
|
||||||
nextStamp = s.nextTimestamp(nextStamp)
|
|
||||||
}
|
|
||||||
series = append(series, row)
|
|
||||||
nextStamp = s.nextTimestamp(nextStamp)
|
|
||||||
}
|
|
||||||
for ets > nextStamp {
|
|
||||||
series = append(series, &TimeseriesValue{
|
|
||||||
Timestamp: nextStamp,
|
|
||||||
Value: 0,
|
|
||||||
})
|
|
||||||
nextStamp = s.nextTimestamp(nextStamp)
|
|
||||||
}
|
|
||||||
return series
|
|
||||||
}
|
|
||||||
|
|
||||||
func NewTimeSeries(step string) *TimeSeries {
|
|
||||||
return &TimeSeries{
|
|
||||||
step: step,
|
|
||||||
values: make([]*TimeseriesValue, 0, 64),
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,66 +0,0 @@
|
||||||
package chartjs
|
|
||||||
|
|
||||||
/*
|
|
||||||
{
|
|
||||||
label: 'My Time Series Data',
|
|
||||||
data: [
|
|
||||||
{ x: '2025-01-01', y: 10 },
|
|
||||||
{ x: '2025-01-02', y: 15 },
|
|
||||||
{ x: '2025-01-03', y: 8 },
|
|
||||||
{ x: '2025-01-04', y: 20 },
|
|
||||||
{ x: '2025-01-05', y: 12 }
|
|
||||||
],
|
|
||||||
borderColor: 'rgb(75, 192, 192)',
|
|
||||||
tension: 0.1
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
type TimeseriesValue struct {
|
|
||||||
Timestamp int64 `json:"x"`
|
|
||||||
Value float64 `json:"y"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// TimeseriesData 时间序列的数据
|
|
||||||
type TimeseriesData struct {
|
|
||||||
Label string `json:"label"`
|
|
||||||
Data []*TimeseriesValue `json:"data"`
|
|
||||||
BorderColor string `json:"borderColor,omitempty"`
|
|
||||||
BackgroundColor string `json:"backgroundColor,omitempty"`
|
|
||||||
Tension float64 `json:"tension,omitempty"`
|
|
||||||
Fill bool `json:"fill,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
{
|
|
||||||
labels: labels,
|
|
||||||
datasets: [
|
|
||||||
{
|
|
||||||
label: 'Dataset 1',
|
|
||||||
data: Utils.numbers(NUMBER_CFG),
|
|
||||||
backgroundColor: [
|
|
||||||
Utils.transparentize(Utils.CHART_COLORS.red, 0.5),
|
|
||||||
Utils.transparentize(Utils.CHART_COLORS.orange, 0.5),
|
|
||||||
Utils.transparentize(Utils.CHART_COLORS.yellow, 0.5),
|
|
||||||
Utils.transparentize(Utils.CHART_COLORS.green, 0.5),
|
|
||||||
Utils.transparentize(Utils.CHART_COLORS.blue, 0.5),
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
type counterValue struct {
|
|
||||||
Label string `json:"label"`
|
|
||||||
Values map[string]float64 `json:"data"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type CounterValue struct {
|
|
||||||
Label string `json:"label"`
|
|
||||||
Data []float64 `json:"data"`
|
|
||||||
BackgroundColor []string `json:"backgroundColor,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type CounterData struct {
|
|
||||||
Lables []string `json:"labels"`
|
|
||||||
Datasets []*CounterValue `json:"datasets"`
|
|
||||||
}
|
|
|
@ -23,9 +23,9 @@ type (
|
||||||
CacheOption func(o *CacheOptions)
|
CacheOption func(o *CacheOptions)
|
||||||
|
|
||||||
cacheEntry[T any] struct {
|
cacheEntry[T any] struct {
|
||||||
Value T `json:"v"`
|
Value T
|
||||||
CompareValue string `json:"d"`
|
CompareValue string
|
||||||
CreatedAt int64 `json:"t"`
|
CreatedAt int64
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -37,19 +37,15 @@ func WithDB(db *gorm.DB) CacheOption {
|
||||||
|
|
||||||
func WithCache(c cache.Cache) CacheOption {
|
func WithCache(c cache.Cache) CacheOption {
|
||||||
return func(o *CacheOptions) {
|
return func(o *CacheOptions) {
|
||||||
if o != nil {
|
|
||||||
o.cache = c
|
o.cache = c
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
func WithCacheDuration(d time.Duration) CacheOption {
|
func WithCacheDuration(d time.Duration) CacheOption {
|
||||||
return func(o *CacheOptions) {
|
return func(o *CacheOptions) {
|
||||||
if d > 0 {
|
|
||||||
o.cacheDuration = d
|
o.cacheDuration = d
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
func WithDependency(d CacheDependency) CacheOption {
|
func WithDependency(d CacheDependency) CacheOption {
|
||||||
return func(o *CacheOptions) {
|
return func(o *CacheOptions) {
|
||||||
|
@ -84,7 +80,7 @@ func TryCache[T any](ctx context.Context, key string, f func(tx *gorm.DB) (T, er
|
||||||
if opts.dependency == nil {
|
if opts.dependency == nil {
|
||||||
return entry.Value, nil
|
return entry.Value, nil
|
||||||
}
|
}
|
||||||
if dependValue, err = opts.dependency.GetValue(ctx, opts.db); err == nil && dependValue != "" {
|
if dependValue, err = opts.dependency.GetValue(ctx, opts.db); err == nil {
|
||||||
hasDependValue = true
|
hasDependValue = true
|
||||||
if entry.CompareValue == dependValue {
|
if entry.CompareValue == dependValue {
|
||||||
return entry.Value, nil
|
return entry.Value, nil
|
||||||
|
@ -98,7 +94,7 @@ func TryCache[T any](ctx context.Context, key string, f func(tx *gorm.DB) (T, er
|
||||||
if val, err, _ = singleInstance.Do(key, func() (any, error) {
|
if val, err, _ = singleInstance.Do(key, func() (any, error) {
|
||||||
if result, err = f(tx); err == nil {
|
if result, err = f(tx); err == nil {
|
||||||
if !hasDependValue && opts.dependency != nil {
|
if !hasDependValue && opts.dependency != nil {
|
||||||
dependValue, _ = opts.dependency.GetValue(ctx, tx)
|
dependValue, err = opts.dependency.GetValue(ctx, tx)
|
||||||
}
|
}
|
||||||
opts.cache.Store(ctx, key, &cacheEntry[T]{
|
opts.cache.Store(ctx, key, &cacheEntry[T]{
|
||||||
CompareValue: dependValue,
|
CompareValue: dependValue,
|
||||||
|
|
|
@ -1,31 +0,0 @@
|
||||||
package dbdialer
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
|
|
||||||
"gorm.io/driver/mysql"
|
|
||||||
"gorm.io/driver/postgres"
|
|
||||||
"gorm.io/driver/sqlite"
|
|
||||||
"gorm.io/gorm"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Dialer open database
|
|
||||||
func Dialer(ctx context.Context, driver string, dsn string, cbs ...Option) (db *gorm.DB, err error) {
|
|
||||||
opts := newOptions(cbs...)
|
|
||||||
|
|
||||||
if opts.cfg == nil {
|
|
||||||
opts.cfg = &gorm.Config{}
|
|
||||||
}
|
|
||||||
opts.cfg.Logger = newLogger(opts.log)
|
|
||||||
switch driver {
|
|
||||||
case mysql.DefaultDriverName:
|
|
||||||
db, err = gorm.Open(mysql.Open(dsn), opts.cfg)
|
|
||||||
case sqlite.DriverName:
|
|
||||||
db, err = gorm.Open(sqlite.Open(dsn), opts.cfg)
|
|
||||||
case "postgres":
|
|
||||||
db, err = gorm.Open(postgres.Open(dsn), opts.cfg)
|
|
||||||
default:
|
|
||||||
err = gorm.ErrNotImplemented
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
|
@ -1,83 +0,0 @@
|
||||||
package dbdialer
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
"errors"
|
|
||||||
"fmt"
|
|
||||||
"time"
|
|
||||||
|
|
||||||
logpkg "git.nobla.cn/golang/aeus/pkg/logger"
|
|
||||||
"gorm.io/gorm/logger"
|
|
||||||
"gorm.io/gorm/utils"
|
|
||||||
)
|
|
||||||
|
|
||||||
type Logger struct {
|
|
||||||
LogLevel logger.LogLevel
|
|
||||||
SlowThreshold time.Duration
|
|
||||||
traceStr string
|
|
||||||
traceErrStr string
|
|
||||||
logger logpkg.Logger
|
|
||||||
}
|
|
||||||
|
|
||||||
func (lg *Logger) LogMode(level logger.LogLevel) logger.Interface {
|
|
||||||
lg.LogLevel = level
|
|
||||||
return lg
|
|
||||||
}
|
|
||||||
|
|
||||||
func (lg *Logger) Info(ctx context.Context, s string, i ...interface{}) {
|
|
||||||
if lg.LogLevel >= logger.Info {
|
|
||||||
lg.logger.Info(ctx, s, i...)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (lg *Logger) Warn(ctx context.Context, s string, i ...interface{}) {
|
|
||||||
if lg.LogLevel >= logger.Warn {
|
|
||||||
lg.logger.Warn(ctx, s, i...)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (lg *Logger) Error(ctx context.Context, s string, i ...interface{}) {
|
|
||||||
if lg.LogLevel >= logger.Error {
|
|
||||||
lg.logger.Error(ctx, s, i...)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (lg *Logger) Trace(ctx context.Context, begin time.Time, fc func() (sql string, rowsAffected int64), err error) {
|
|
||||||
if lg.LogLevel <= logger.Silent {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
elapsed := time.Since(begin)
|
|
||||||
switch {
|
|
||||||
case err != nil && lg.LogLevel >= logger.Error && (!errors.Is(err, logger.ErrRecordNotFound)):
|
|
||||||
sql, rows := fc()
|
|
||||||
if rows == -1 {
|
|
||||||
lg.Warn(ctx, lg.traceErrStr, sql, err, float64(elapsed.Nanoseconds())/1e6, "-", utils.FileWithLineNum())
|
|
||||||
} else {
|
|
||||||
lg.Warn(ctx, lg.traceErrStr, sql, err, float64(elapsed.Nanoseconds())/1e6, rows, utils.FileWithLineNum())
|
|
||||||
}
|
|
||||||
case elapsed > lg.SlowThreshold && lg.SlowThreshold != 0 && lg.LogLevel >= logger.Warn:
|
|
||||||
sql, rows := fc()
|
|
||||||
slowLog := fmt.Sprintf("SLOW SQL >= %v", lg.SlowThreshold)
|
|
||||||
if rows == -1 {
|
|
||||||
lg.Warn(ctx, lg.traceErrStr, sql, slowLog, float64(elapsed.Nanoseconds())/1e6, "-", utils.FileWithLineNum())
|
|
||||||
} else {
|
|
||||||
lg.Warn(ctx, lg.traceErrStr, sql, slowLog, float64(elapsed.Nanoseconds())/1e6, rows, utils.FileWithLineNum())
|
|
||||||
}
|
|
||||||
case lg.LogLevel == logger.Info:
|
|
||||||
sql, rows := fc()
|
|
||||||
if rows == -1 {
|
|
||||||
lg.Info(ctx, lg.traceStr, sql, float64(elapsed.Nanoseconds())/1e6, "-", utils.FileWithLineNum())
|
|
||||||
} else {
|
|
||||||
lg.Info(ctx, lg.traceStr, sql, float64(elapsed.Nanoseconds())/1e6, rows, utils.FileWithLineNum())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func newLogger(log logpkg.Logger) *Logger {
|
|
||||||
return &Logger{
|
|
||||||
logger: log,
|
|
||||||
SlowThreshold: time.Second * 10,
|
|
||||||
traceStr: "%s [%.3fms] [rows:%v] in %s",
|
|
||||||
traceErrStr: "%s [%s] [%.3fms] [rows:%v] in %s",
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,38 +0,0 @@
|
||||||
package dbdialer
|
|
||||||
|
|
||||||
import (
|
|
||||||
"git.nobla.cn/golang/aeus/pkg/logger"
|
|
||||||
"gorm.io/gorm"
|
|
||||||
)
|
|
||||||
|
|
||||||
type (
|
|
||||||
options struct {
|
|
||||||
log logger.Logger
|
|
||||||
cfg *gorm.Config
|
|
||||||
}
|
|
||||||
|
|
||||||
Option func(o *options)
|
|
||||||
)
|
|
||||||
|
|
||||||
func WithConfig(cfg *gorm.Config) Option {
|
|
||||||
return func(o *options) {
|
|
||||||
o.cfg = cfg
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func WithLogger(log logger.Logger) Option {
|
|
||||||
return func(o *options) {
|
|
||||||
o.log = log
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func newOptions(opts ...Option) *options {
|
|
||||||
o := &options{
|
|
||||||
cfg: &gorm.Config{},
|
|
||||||
log: logger.Default(),
|
|
||||||
}
|
|
||||||
for _, opt := range opts {
|
|
||||||
opt(o)
|
|
||||||
}
|
|
||||||
return o
|
|
||||||
}
|
|
185
server.go
185
server.go
|
@ -10,7 +10,6 @@ import (
|
||||||
"reflect"
|
"reflect"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
|
||||||
|
|
||||||
"git.nobla.cn/golang/aeus-admin/migrate"
|
"git.nobla.cn/golang/aeus-admin/migrate"
|
||||||
"git.nobla.cn/golang/aeus-admin/models"
|
"git.nobla.cn/golang/aeus-admin/models"
|
||||||
|
@ -251,6 +250,23 @@ func initModels(ctx context.Context, o *options) (err error) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// AutoMigrate 自动生成一个模型的schema和权限的定义
|
||||||
|
func AutoMigrate(ctx context.Context, db *gorm.DB, model any, cbs ...Option) (err error) {
|
||||||
|
var (
|
||||||
|
mv *rest.Model
|
||||||
|
)
|
||||||
|
opts := newOptions(cbs...)
|
||||||
|
if mm, ok := model.(adminTypes.ModuleModel); ok {
|
||||||
|
moduleName := mm.ModuleName()
|
||||||
|
opts.restOpts = append(opts.restOpts, rest.WithModuleName(moduleName))
|
||||||
|
}
|
||||||
|
if mv, err = rest.AutoMigrate(ctx, model, opts.restOpts...); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
err = checkModel(opts, mv)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
func registerRESTRoute(domain string, db *gorm.DB, hs *http.Server) {
|
func registerRESTRoute(domain string, db *gorm.DB, hs *http.Server) {
|
||||||
handleListSchemas := func(ctx *http.Context) (err error) {
|
handleListSchemas := func(ctx *http.Context) (err error) {
|
||||||
var (
|
var (
|
||||||
|
@ -335,177 +351,10 @@ func registerRESTRoute(domain string, db *gorm.DB, hs *http.Server) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
handleKeyValues := func(ctx *http.Context) (err error) {
|
|
||||||
var (
|
|
||||||
dbDependency dbcache.CacheDependency
|
|
||||||
pairs []*restTypes.TypeValue[any]
|
|
||||||
modelValue any
|
|
||||||
)
|
|
||||||
moduleName := ctx.Param("module")
|
|
||||||
tableName := ctx.Param("table")
|
|
||||||
entities := rest.GetModels()
|
|
||||||
for _, entry := range entities {
|
|
||||||
if entry.ModuleName() == moduleName && entry.TableName() == tableName {
|
|
||||||
modelValue = reflect.New(entry.Value().Type()).Interface()
|
|
||||||
for _, field := range entry.Fields() {
|
|
||||||
if field.AutoUpdateTime > 0 {
|
|
||||||
dbDependency = dbcache.NewSqlDependency(fmt.Sprintf("SELECT MAX(`%s`) FROM `%s`", field.DBName, entry.TableName()))
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if modelValue == nil {
|
|
||||||
return ctx.Error(errors.NotFound, "model not found")
|
|
||||||
}
|
|
||||||
labelColumn := ctx.Param("label")
|
|
||||||
valueColumn := ctx.Param("value")
|
|
||||||
opts := make([]dbcache.CacheOption, 0, 4)
|
|
||||||
opts = append(opts, dbcache.WithDB(db))
|
|
||||||
if dbDependency != nil {
|
|
||||||
opts = append(opts, dbcache.WithCacheDuration(time.Minute*30))
|
|
||||||
opts = append(opts, dbcache.WithDependency(dbDependency))
|
|
||||||
} else {
|
|
||||||
opts = append(opts, dbcache.WithCacheDuration(time.Minute))
|
|
||||||
}
|
|
||||||
if pairs, err = dbcache.TryCache(ctx.Context(), fmt.Sprintf("rest:kvpairs:%s:%s:%s:%s", moduleName, tableName, labelColumn, valueColumn), func(tx *gorm.DB) ([]*restTypes.TypeValue[any], error) {
|
|
||||||
return rest.ModelTypes[any](ctx.Context(), db, modelValue, "", labelColumn, valueColumn)
|
|
||||||
}, opts...); err == nil {
|
|
||||||
return ctx.Success(pairs)
|
|
||||||
} else {
|
|
||||||
return ctx.Error(errors.Unavailable, err.Error())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
handleTierPairs := func(ctx *http.Context) (err error) {
|
|
||||||
var (
|
|
||||||
dbDependency dbcache.CacheDependency
|
|
||||||
pairs []*restTypes.TierValue[string]
|
|
||||||
modelValue any
|
|
||||||
)
|
|
||||||
moduleName := ctx.Param("module")
|
|
||||||
tableName := ctx.Param("table")
|
|
||||||
entities := rest.GetModels()
|
|
||||||
for _, entry := range entities {
|
|
||||||
if entry.ModuleName() == moduleName && entry.TableName() == tableName {
|
|
||||||
// 权限控制
|
|
||||||
if err = entry.HasPermission(ctx.Context(), entry.Permission(restTypes.ScenarioList)); err != nil {
|
|
||||||
return ctx.Error(errors.AccessDenied, err.Error())
|
|
||||||
}
|
|
||||||
modelValue = reflect.New(entry.Value().Type()).Interface()
|
|
||||||
for _, field := range entry.Fields() {
|
|
||||||
if field.AutoUpdateTime > 0 {
|
|
||||||
dbDependency = dbcache.NewSqlDependency(fmt.Sprintf("SELECT MAX(`%s`) FROM `%s`", field.DBName, entry.TableName()))
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if modelValue == nil {
|
|
||||||
return ctx.Error(errors.NotFound, "model not found")
|
|
||||||
}
|
|
||||||
parentColumn := ctx.Param("parent")
|
|
||||||
labelColumn := ctx.Param("label")
|
|
||||||
valueColumn := ctx.Param("value")
|
|
||||||
opts := make([]dbcache.CacheOption, 0, 4)
|
|
||||||
opts = append(opts, dbcache.WithDB(db))
|
|
||||||
if dbDependency != nil {
|
|
||||||
opts = append(opts, dbcache.WithCacheDuration(time.Minute*30))
|
|
||||||
opts = append(opts, dbcache.WithDependency(dbDependency))
|
|
||||||
} else {
|
|
||||||
opts = append(opts, dbcache.WithCacheDuration(time.Minute))
|
|
||||||
}
|
|
||||||
if pairs, err = dbcache.TryCache(ctx.Context(), fmt.Sprintf("rest:tierpairs:%s:%s:%s:%s", moduleName, tableName, labelColumn, valueColumn), func(tx *gorm.DB) ([]*restTypes.TierValue[string], error) {
|
|
||||||
return rest.ModelTiers[string](ctx.Context(), db, modelValue, "", parentColumn, labelColumn, valueColumn)
|
|
||||||
}, opts...); err == nil {
|
|
||||||
return ctx.Success(pairs)
|
|
||||||
} else {
|
|
||||||
return ctx.Error(errors.Unavailable, err.Error())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
handleNumberTierPairs := func(ctx *http.Context) (err error) {
|
|
||||||
var (
|
|
||||||
dbDependency dbcache.CacheDependency
|
|
||||||
pairs []*restTypes.TierValue[int64]
|
|
||||||
modelValue any
|
|
||||||
)
|
|
||||||
moduleName := ctx.Param("module")
|
|
||||||
tableName := ctx.Param("table")
|
|
||||||
entities := rest.GetModels()
|
|
||||||
for _, entry := range entities {
|
|
||||||
if entry.ModuleName() == moduleName && entry.TableName() == tableName {
|
|
||||||
// 权限控制
|
|
||||||
if err = entry.HasPermission(ctx.Context(), entry.Permission(restTypes.ScenarioList)); err != nil {
|
|
||||||
return ctx.Error(errors.AccessDenied, err.Error())
|
|
||||||
}
|
|
||||||
modelValue = reflect.New(entry.Value().Type()).Interface()
|
|
||||||
for _, field := range entry.Fields() {
|
|
||||||
if field.AutoUpdateTime > 0 {
|
|
||||||
dbDependency = dbcache.NewSqlDependency(fmt.Sprintf("SELECT MAX(`%s`) FROM `%s`", field.DBName, entry.TableName()))
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if modelValue == nil {
|
|
||||||
return ctx.Error(errors.NotFound, "model not found")
|
|
||||||
}
|
|
||||||
parentColumn := ctx.Param("parent")
|
|
||||||
labelColumn := ctx.Param("label")
|
|
||||||
valueColumn := ctx.Param("value")
|
|
||||||
opts := make([]dbcache.CacheOption, 0, 4)
|
|
||||||
opts = append(opts, dbcache.WithDB(db))
|
|
||||||
if dbDependency != nil {
|
|
||||||
opts = append(opts, dbcache.WithCacheDuration(time.Minute*30))
|
|
||||||
opts = append(opts, dbcache.WithDependency(dbDependency))
|
|
||||||
} else {
|
|
||||||
opts = append(opts, dbcache.WithCacheDuration(time.Minute))
|
|
||||||
}
|
|
||||||
if pairs, err = dbcache.TryCache(ctx.Context(), fmt.Sprintf("rest:tierpairs:%s:%s:%s:%s", moduleName, tableName, labelColumn, valueColumn), func(tx *gorm.DB) ([]*restTypes.TierValue[int64], error) {
|
|
||||||
return rest.ModelTiers[int64](ctx.Context(), db, modelValue, "", parentColumn, labelColumn, valueColumn)
|
|
||||||
}, opts...); err == nil {
|
|
||||||
return ctx.Success(pairs)
|
|
||||||
} else {
|
|
||||||
return ctx.Error(errors.Unavailable, err.Error())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
hs.GET("/rest/schema/:module/:table", handleListSchemas)
|
hs.GET("/rest/schema/:module/:table", handleListSchemas)
|
||||||
hs.PUT("/rest/schema/:module/:table", handleUpdateSchemas)
|
hs.PUT("/rest/schema/:module/:table", handleUpdateSchemas)
|
||||||
hs.DELETE("/rest/schema/:id", handleDeleteSchema)
|
hs.DELETE("/rest/schema/:id", handleDeleteSchema)
|
||||||
hs.GET("/rest/kvpairs/:module/:table/:value/:label", handleKeyValues) //处理键值对数据
|
|
||||||
hs.GET("/rest/tierpairs/str/:module/:table/:parent/:value/:label", handleTierPairs) //处理字符串类型的层级数据
|
|
||||||
hs.GET("/rest/tierpairs/num/:module/:table/:parent/:value/:label", handleNumberTierPairs) //处理数字类型的层级数据, 只支持int64
|
|
||||||
}
|
|
||||||
|
|
||||||
// AutoMigrate 自动生成一个模型的schema和权限的定义
|
|
||||||
func AutoMigrate(ctx context.Context, db *gorm.DB, model any, cbs ...Option) (err error) {
|
|
||||||
var (
|
|
||||||
mv *rest.Model
|
|
||||||
)
|
|
||||||
opts := newOptions(cbs...)
|
|
||||||
if mm, ok := model.(adminTypes.ModuleModel); ok {
|
|
||||||
moduleName := mm.ModuleName()
|
|
||||||
opts.restOpts = append(opts.restOpts, rest.WithModuleName(moduleName))
|
|
||||||
}
|
|
||||||
if err = db.AutoMigrate(model); err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if mv, err = rest.AutoMigrate(ctx, model, opts.restOpts...); err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if err = checkModel(opts, mv); err == nil {
|
|
||||||
if opts.vuePath != "" {
|
|
||||||
if err = generateVueFile(opts.vuePath, opts.apiPrefix, mv); err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Init 初始化模块
|
// Init 初始化模块
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
package service
|
package service
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"bytes"
|
||||||
"context"
|
"context"
|
||||||
|
"encoding/json"
|
||||||
"net/http"
|
"net/http"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
@ -11,7 +13,6 @@ import (
|
||||||
"git.nobla.cn/golang/aeus/metadata"
|
"git.nobla.cn/golang/aeus/metadata"
|
||||||
"git.nobla.cn/golang/aeus/pkg/cache"
|
"git.nobla.cn/golang/aeus/pkg/cache"
|
||||||
"git.nobla.cn/golang/aeus/pkg/errors"
|
"git.nobla.cn/golang/aeus/pkg/errors"
|
||||||
"git.nobla.cn/golang/aeus/pkg/httpclient"
|
|
||||||
jwt "github.com/golang-jwt/jwt/v5"
|
jwt "github.com/golang-jwt/jwt/v5"
|
||||||
"github.com/mssola/useragent"
|
"github.com/mssola/useragent"
|
||||||
"gorm.io/gorm"
|
"gorm.io/gorm"
|
||||||
|
@ -100,6 +101,11 @@ func WithAuthTTL(ttl int64) AuthOption {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *AuthService) turnstileValidate(ctx context.Context, token string) (err error) {
|
func (s *AuthService) turnstileValidate(ctx context.Context, token string) (err error) {
|
||||||
|
var (
|
||||||
|
buf []byte
|
||||||
|
req *http.Request
|
||||||
|
res *http.Response
|
||||||
|
)
|
||||||
if s.opts.turnstileSiteKey == "" || s.opts.turnstileValidateUrl == "" {
|
if s.opts.turnstileSiteKey == "" || s.opts.turnstileValidateUrl == "" {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -107,14 +113,22 @@ func (s *AuthService) turnstileValidate(ctx context.Context, token string) (err
|
||||||
Secret: s.opts.turnstileSiteKey,
|
Secret: s.opts.turnstileSiteKey,
|
||||||
Response: token,
|
Response: token,
|
||||||
}
|
}
|
||||||
|
if buf, err = json.Marshal(payload); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if req, err = http.NewRequestWithContext(ctx, http.MethodPost, s.opts.turnstileValidateUrl, bytes.NewReader(buf)); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
req.Header.Set("Content-Type", "application/json")
|
||||||
|
if res, err = http.DefaultClient.Do(req); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
defer res.Body.Close()
|
||||||
|
if res.StatusCode != http.StatusOK {
|
||||||
|
return errors.Format(errors.Unavailable, "turnstile validate failed")
|
||||||
|
}
|
||||||
result := &turnstileResponse{}
|
result := &turnstileResponse{}
|
||||||
if err = httpclient.Do(
|
if err = json.NewDecoder(res.Body).Decode(result); err != nil {
|
||||||
ctx,
|
|
||||||
s.opts.turnstileValidateUrl,
|
|
||||||
result,
|
|
||||||
httpclient.WithMethod(http.MethodPost),
|
|
||||||
httpclient.WithBody(payload),
|
|
||||||
); err != nil {
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if !result.Success {
|
if !result.Success {
|
||||||
|
@ -148,7 +162,6 @@ func (s *AuthService) Login(ctx context.Context, req *pb.LoginRequest) (res *pb.
|
||||||
claims := types.Claims{
|
claims := types.Claims{
|
||||||
Uid: model.Uid,
|
Uid: model.Uid,
|
||||||
Role: model.Role,
|
Role: model.Role,
|
||||||
Admin: model.Admin,
|
|
||||||
IssuedAt: time.Now().Unix(),
|
IssuedAt: time.Now().Unix(),
|
||||||
ExpirationAt: time.Now().Add(time.Second * time.Duration(s.opts.ttl)).Unix(),
|
ExpirationAt: time.Now().Add(time.Second * time.Duration(s.opts.ttl)).Unix(),
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,24 +35,6 @@ func WithMenuDB(db *gorm.DB) MenuOption {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *MenuService) recursiveMenuValue(parent string, items []*models.Menu) []*pb.MenuValue {
|
|
||||||
values := make([]*pb.MenuValue, 0, len(items))
|
|
||||||
for _, row := range items {
|
|
||||||
if row.Parent == parent {
|
|
||||||
item := &pb.MenuValue{
|
|
||||||
Id: row.Id,
|
|
||||||
Parent: row.Parent,
|
|
||||||
Name: row.Name,
|
|
||||||
Label: row.Label,
|
|
||||||
Children: make([]*pb.MenuValue, 0),
|
|
||||||
}
|
|
||||||
item.Children = append(item.Children, s.recursiveMenuValue(row.Name, items)...)
|
|
||||||
values = append(values, item)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return values
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *MenuService) recursiveMenuLevel(parent string, items []*models.Menu) []*pb.MenuLevelValue {
|
func (s *MenuService) recursiveMenuLevel(parent string, items []*models.Menu) []*pb.MenuLevelValue {
|
||||||
values := make([]*pb.MenuLevelValue, 0, len(items))
|
values := make([]*pb.MenuLevelValue, 0, len(items))
|
||||||
for _, row := range items {
|
for _, row := range items {
|
||||||
|
@ -69,19 +51,6 @@ func (s *MenuService) recursiveMenuLevel(parent string, items []*models.Menu) []
|
||||||
return values
|
return values
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *MenuService) GetMenus(ctx context.Context, req *pb.GetMenuRequest) (res *pb.GetMenuResponse, err error) {
|
|
||||||
var (
|
|
||||||
items []*models.Menu
|
|
||||||
)
|
|
||||||
if items, err = s.logic.GetMenus(ctx); err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
res = &pb.GetMenuResponse{
|
|
||||||
Data: s.recursiveMenuValue("", items),
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *MenuService) GetMenuLevelLabels(ctx context.Context, req *pb.GetMenuLevelLabelsRequest) (res *pb.GetMenuLevelLabelsResponse, err error) {
|
func (s *MenuService) GetMenuLevelLabels(ctx context.Context, req *pb.GetMenuLevelLabelsRequest) (res *pb.GetMenuLevelLabelsResponse, err error) {
|
||||||
var (
|
var (
|
||||||
items []*models.Menu
|
items []*models.Menu
|
||||||
|
|
|
@ -17,7 +17,6 @@ type (
|
||||||
|
|
||||||
SettingOption func(o *settingOptions)
|
SettingOption func(o *settingOptions)
|
||||||
)
|
)
|
||||||
|
|
||||||
type SettingService struct {
|
type SettingService struct {
|
||||||
opts *settingOptions
|
opts *settingOptions
|
||||||
}
|
}
|
||||||
|
|
|
@ -102,7 +102,7 @@ func (s *UserService) recursiveNestedMenu(ctx context.Context, parent string, pe
|
||||||
return values
|
return values
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *UserService) GetMenus(ctx context.Context, req *pb.GetUserMenuRequest) (res *pb.GetUserMenuResponse, err error) {
|
func (s *UserService) GetMenus(ctx context.Context, req *pb.GetMenuRequest) (res *pb.GetMenuResponse, err error) {
|
||||||
var (
|
var (
|
||||||
uid string
|
uid string
|
||||||
permissions []*models.Permission
|
permissions []*models.Permission
|
||||||
|
@ -110,14 +110,14 @@ func (s *UserService) GetMenus(ctx context.Context, req *pb.GetUserMenuRequest)
|
||||||
if uid, err = s.getUidFromContext(ctx); err != nil {
|
if uid, err = s.getUidFromContext(ctx); err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
res = &pb.GetUserMenuResponse{}
|
res = &pb.GetMenuResponse{}
|
||||||
res.Data, err = dbcache.TryCache(ctx, fmt.Sprintf("user:menu:%s:%v", uid, req.Permission), func(tx *gorm.DB) ([]*pb.MenuItem, error) {
|
res.Data, err = dbcache.TryCache(ctx, fmt.Sprintf("user:menu:%s:%v", uid, req.Permission), func(tx *gorm.DB) ([]*pb.MenuItem, error) {
|
||||||
var (
|
var (
|
||||||
userModel *models.User
|
userModel *models.User
|
||||||
menus []*models.Menu
|
menus []*models.Menu
|
||||||
)
|
)
|
||||||
userModel = &models.User{}
|
userModel = &models.User{}
|
||||||
if err = tx.Where("`uid`=?", uid).First(userModel).Error; err != nil {
|
if err = tx.Where("uid=?", uid).First(userModel).Error; err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
if menus, err = s.menu.GetMenus(ctx); err != nil {
|
if menus, err = s.menu.GetMenus(ctx); err != nil {
|
||||||
|
|
|
@ -9,7 +9,6 @@ import (
|
||||||
type Claims struct {
|
type Claims struct {
|
||||||
Uid string `json:"uid"`
|
Uid string `json:"uid"`
|
||||||
Role string `json:"uro"`
|
Role string `json:"uro"`
|
||||||
Admin bool `json:"uab"`
|
|
||||||
Issuer string `json:"iss"`
|
Issuer string `json:"iss"`
|
||||||
IssuedAt int64 `json:"iat"`
|
IssuedAt int64 `json:"iat"`
|
||||||
ExpirationAt int64 `json:"exp"`
|
ExpirationAt int64 `json:"exp"`
|
||||||
|
|
Loading…
Reference in New Issue