Skip to content

Instantly share code, notes, and snippets.

@bxcodec
bxcodec / _struct_to_map.go
Last active January 13, 2023 07:29
Golang Struct To Map Example By JSON tag
View _struct_to_map.go
/*
This function will help you to convert your object from struct to map[string]interface{} based on your JSON tag in your structs.
Example how to use posted in sample_test.go file.
*/
func structToMap(item interface{}) map[string]interface{} {
res := map[string]interface{}{}
if item == nil {
return res
}
@zmts
zmts / tokens.md
Last active September 22, 2023 17:59
Про токены, JSON Web Tokens (JWT), аутентификацию и авторизацию. Token-Based Authentication
View tokens.md