Skip to content

Commit

Permalink
Update xsql BuildTagValues Embedding
Browse files Browse the repository at this point in the history
  • Loading branch information
onanying committed Mar 22, 2024
1 parent 3c65735 commit 1f1133a
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/xsql/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ import (
"reflect"
)

// BuildTagValues takes a tag key, a pointer to a struct, and a series of pointers to struct fields with their corresponding values.
// It returns a map where each key is the tag value of the struct field, and each value is the corresponding value from the pairs.
// If the number of arguments in pairs is not even, an error is returned since they should be provided as pointer-value pairs.
func BuildTagValues(tagKey string, ptr interface{}, pairs ...interface{}) (map[string]interface{}, error) {
if len(pairs)%2 != 0 {
return nil, fmt.Errorf("xsql: arguments should be in pairs")
Expand Down

0 comments on commit 1f1133a

Please sign in to comment.