Skip to content

Commit

Permalink
Merge pull request #32 from origadmin/dev
Browse files Browse the repository at this point in the history
Merge dev into main
  • Loading branch information
godcong authored Nov 26, 2024
2 parents 3ccd42a + 1b510bb commit b63ac98
Show file tree
Hide file tree
Showing 237 changed files with 1,273 additions and 223 deletions.
4 changes: 4 additions & 0 deletions cmd/protoc-gen-go-gins/gins.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/*
* Copyright (c) 2024 OrigAdmin. All rights reserved.
*/

package main

import (
Expand Down
10 changes: 5 additions & 5 deletions cmd/protoc-gen-go-gins/ginsTemplate.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -26,28 +26,28 @@ func Register{{.ServiceType}}GINSServer(router gin.IRouter, srv {{.ServiceType}}
var in {{.Request}}
{{- if.HasBody}}
if err := gins.BindBody(ctx,&in{{.Body}}); err != nil {
ctx.Error(err)
gins.RetError(ctx,err)
return
}
{{- end}}
if err := gins.BindQuery(ctx,&in); err != nil {
ctx.Error(err)
gins.RetError(ctx,err)
return
}
{{- if.HasVars}}
if err := gins.BindURI(ctx,&in); err != nil {
ctx.Error(err)
gins.RetError(ctx,err)
return
}
{{- end}}
gins.SetOperation(ctx, {{$svrType}}_{{.OriginalName}}_OperationName)
newCtx := gins.NewContext(ctx)
reply, err := srv.{{.Name}}(newCtx, &in)
if err != nil {
ctx.Error(err)
gins.RetError(ctx,err)
return
}
ctx.JSON(200, reply{{.ResponseBody}})
gins.RetJSON(ctx,200, reply{{.ResponseBody}})
return
}
}
Expand Down
4 changes: 4 additions & 0 deletions cmd/protoc-gen-go-gins/gins_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/*
* Copyright (c) 2024 OrigAdmin. All rights reserved.
*/

package main

import (
Expand Down
4 changes: 4 additions & 0 deletions cmd/protoc-gen-go-gins/main.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/*
* Copyright (c) 2024 OrigAdmin. All rights reserved.
*/

package main

import (
Expand Down
4 changes: 4 additions & 0 deletions cmd/protoc-gen-go-gins/template.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/*
* Copyright (c) 2024 OrigAdmin. All rights reserved.
*/

package main

import (
Expand Down
4 changes: 4 additions & 0 deletions cmd/protoc-gen-go-gins/version.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/*
* Copyright (c) 2024 OrigAdmin. All rights reserved.
*/

package main

// version is the current protoc-gen-go-gins version.
Expand Down
4 changes: 4 additions & 0 deletions cmd/version/main.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/*
* Copyright (c) 2024 OrigAdmin. All rights reserved.
*/

package main

import (
Expand Down
4 changes: 3 additions & 1 deletion codec/codec.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
// Copyright (c) 2024 OrigAdmin. All rights reserved.
/*
* Copyright (c) 2024 OrigAdmin. All rights reserved.
*/

// Package codec is the codec package for encoding and decoding
package codec
Expand Down
4 changes: 3 additions & 1 deletion codec/decode.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
// Copyright (c) 2024 OrigAdmin. All rights reserved.
/*
* Copyright (c) 2024 OrigAdmin. All rights reserved.
*/

// Package codec is the codec package for encoding and decoding
package codec
Expand Down
4 changes: 3 additions & 1 deletion codec/encode.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
// Copyright (c) 2024 OrigAdmin. All rights reserved.
/*
* Copyright (c) 2024 OrigAdmin. All rights reserved.
*/

// Package codec is the codec package for encoding and decoding
package codec
Expand Down
4 changes: 4 additions & 0 deletions codec/ini/Marshal_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/*
* Copyright (c) 2024 OrigAdmin. All rights reserved.
*/

package ini

import (
Expand Down
4 changes: 4 additions & 0 deletions codec/ini/Unmarshal_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/*
* Copyright (c) 2024 OrigAdmin. All rights reserved.
*/

package ini

import (
Expand Down
4 changes: 4 additions & 0 deletions codec/ini/codec.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/*
* Copyright (c) 2024 OrigAdmin. All rights reserved.
*/

package ini

var (
Expand Down
4 changes: 4 additions & 0 deletions codec/ini/ini.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/*
* Copyright (c) 2024 OrigAdmin. All rights reserved.
*/

package ini

import (
Expand Down
4 changes: 4 additions & 0 deletions codec/json/codec.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/*
* Copyright (c) 2024 OrigAdmin. All rights reserved.
*/

package json

var (
Expand Down
6 changes: 4 additions & 2 deletions codec/json/json.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
// Copyright (c) 2024 OrigAdmin. All rights reserved.

//go:build !jsoniter && !sonic

/*
* Copyright (c) 2024 OrigAdmin. All rights reserved.
*/

// Package json provides the json functions based on standard library
package json

Expand Down
6 changes: 4 additions & 2 deletions codec/json/jsoniter.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
// Copyright (c) 2024 OrigAdmin. All rights reserved.

//go:build jsoniter

/*
* Copyright (c) 2024 OrigAdmin. All rights reserved.
*/

// Package json provides the json functions based on github.com/json-iterator/go
package json

Expand Down
6 changes: 4 additions & 2 deletions codec/json/sonic.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
// Copyright (c) 2024 OrigAdmin. All rights reserved.

//go:build sonic

/*
* Copyright (c) 2024 OrigAdmin. All rights reserved.
*/

// Package json provides the json functions based on standard library
package json

Expand Down
4 changes: 4 additions & 0 deletions codec/toml/codec.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/*
* Copyright (c) 2024 OrigAdmin. All rights reserved.
*/

package toml

var (
Expand Down
4 changes: 3 additions & 1 deletion codec/toml/toml.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
// Copyright (c) 2024 OrigAdmin. All rights reserved.
/*
* Copyright (c) 2024 OrigAdmin. All rights reserved.
*/

// Package toml provides the toml functions
package toml
Expand Down
4 changes: 3 additions & 1 deletion codec/toml/toml_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
// Copyright (c) 2024 OrigAdmin. All rights reserved.
/*
* Copyright (c) 2024 OrigAdmin. All rights reserved.
*/

// Package toml provides the helpers functions
package toml
Expand Down
10 changes: 10 additions & 0 deletions codec/type.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
/*
* Copyright (c) 2024 OrigAdmin. All rights reserved.
*/

package codec

import (
"io"
"path/filepath"

"github.com/origadmin/toolkits/codec/ini"
"github.com/origadmin/toolkits/codec/json"
Expand Down Expand Up @@ -149,3 +154,8 @@ func TypeFromExt(ext string) Type {
return UNKNOWN
}
}

// TypeFromPath returns the codec type from the file path.
func TypeFromPath(path string) Type {
return TypeFromExt(filepath.Ext(path))
}
4 changes: 4 additions & 0 deletions codec/xml/codec.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/*
* Copyright (c) 2024 OrigAdmin. All rights reserved.
*/

package xml

var (
Expand Down
4 changes: 4 additions & 0 deletions codec/xml/xml.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/*
* Copyright (c) 2024 OrigAdmin. All rights reserved.
*/

package xml

import (
Expand Down
4 changes: 4 additions & 0 deletions codec/yaml/codec.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/*
* Copyright (c) 2024 OrigAdmin. All rights reserved.
*/

package yaml

var (
Expand Down
4 changes: 3 additions & 1 deletion codec/yaml/yaml.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
// Copyright (c) 2024 OrigAdmin. All rights reserved.
/*
* Copyright (c) 2024 OrigAdmin. All rights reserved.
*/

// Package yaml provides the yaml functions
package yaml
Expand Down
5 changes: 5 additions & 0 deletions context/alias.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/*
* Copyright (c) 2024 OrigAdmin. All rights reserved.
*/

// Package context provides the context functions
package context

import (
Expand Down
4 changes: 3 additions & 1 deletion context/context.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
// Copyright (c) 2024 OrigAdmin. All rights reserved.
/*
* Copyright (c) 2024 OrigAdmin. All rights reserved.
*/

// Package context provides the context functions
package context
Expand Down
4 changes: 4 additions & 0 deletions context/context_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/*
* Copyright (c) 2024 OrigAdmin. All rights reserved.
*/

package context

import (
Expand Down
4 changes: 4 additions & 0 deletions contrib/cache/memory/memory.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/*
* Copyright (c) 2024 OrigAdmin. All rights reserved.
*/

package memory

import (
Expand Down
4 changes: 3 additions & 1 deletion contrib/casbin/ent/ent.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
// Copyright (c) 2024 OrigAdmin. All rights reserved.
/*
* Copyright (c) 2024 OrigAdmin. All rights reserved.
*/

// Package ent is the casbin ent adapter package
package ent
Expand Down
4 changes: 3 additions & 1 deletion contrib/casbin/memory/memory.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
// Copyright (c) 2024 OrigAdmin. All rights reserved.
/*
* Copyright (c) 2024 OrigAdmin. All rights reserved.
*/

// Package memory is the memory adapter of Casbin.
package memory
Expand Down
4 changes: 4 additions & 0 deletions contrib/config/envf/envf.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/*
* Copyright (c) 2024 OrigAdmin. All rights reserved.
*/

package envf

import (
Expand Down
4 changes: 4 additions & 0 deletions contrib/config/envf/envf_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/*
* Copyright (c) 2024 OrigAdmin. All rights reserved.
*/

package envf

import (
Expand Down
4 changes: 4 additions & 0 deletions contrib/config/envf/watcher.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/*
* Copyright (c) 2024 OrigAdmin. All rights reserved.
*/

package envf

import (
Expand Down
4 changes: 4 additions & 0 deletions contrib/config/envf/watcher_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/*
* Copyright (c) 2024 OrigAdmin. All rights reserved.
*/

package envf

import (
Expand Down
4 changes: 4 additions & 0 deletions contrib/config/obj/object.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/*
* Copyright (c) 2024 OrigAdmin. All rights reserved.
*/

package obj

import (
Expand Down
4 changes: 4 additions & 0 deletions contrib/config/obj/object_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/*
* Copyright (c) 2024 OrigAdmin. All rights reserved.
*/

package obj

import (
Expand Down
4 changes: 4 additions & 0 deletions contrib/config/obj/watcher.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/*
* Copyright (c) 2024 OrigAdmin. All rights reserved.
*/

package obj

import (
Expand Down
4 changes: 4 additions & 0 deletions contrib/config/source.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/*
* Copyright (c) 2024 OrigAdmin. All rights reserved.
*/

package config

import (
Expand Down
Loading

0 comments on commit b63ac98

Please sign in to comment.