All Projects → scylladb → Go Reflectx

scylladb / Go Reflectx

Licence: apache-2.0
Go reflection library to find struct field by its tag

Programming Languages

go
31211 projects - #10 most used programming language
golang
3204 projects
reflection
70 projects

Labels

Projects that are alternatives of or similar to Go Reflectx

Redis Tag Cache
Cache and invalidate records in Redis with tags
Stars: ✭ 48 (+152.63%)
Mutual labels:  cache, tags
Once
A magic memoization function
Stars: ✭ 821 (+4221.05%)
Mutual labels:  cache
Offix
GraphQL Offline Client and Server
Stars: ✭ 694 (+3552.63%)
Mutual labels:  cache
Smartsql
SmartSql = MyBatis in C# + .NET Core+ Cache(Memory | Redis) + R/W Splitting + PropertyChangedTrack +Dynamic Repository + InvokeSync + Diagnostics
Stars: ✭ 775 (+3978.95%)
Mutual labels:  cache
Xmemcached
High performance, easy to use multithreaded memcached client in java.
Stars: ✭ 715 (+3663.16%)
Mutual labels:  cache
Yac
A fast, lock-free, shared memory user data cache for PHP
Stars: ✭ 782 (+4015.79%)
Mutual labels:  cache
React Router Cache Route
Route with cache for React-Router like <keep-alive/> in Vue
Stars: ✭ 677 (+3463.16%)
Mutual labels:  cache
Edinote
Note taking web application for self-hosting. Offers tagging & Markdown support; can be used as a simple alternative to Evernote.
Stars: ✭ 17 (-10.53%)
Mutual labels:  tags
Cleanmywechat
自动删除 PC 端微信缓存数据,包括从所有聊天中自动下载的大量文件、视频、图片等数据内容,解放你的空间。
Stars: ✭ 816 (+4194.74%)
Mutual labels:  cache
Gocache
☔️ A complete Go cache library that brings you multiple ways of managing your caches
Stars: ✭ 775 (+3978.95%)
Mutual labels:  cache
Vue Tags Input
A tags input component for VueJS
Stars: ✭ 761 (+3905.26%)
Mutual labels:  tags
React Native Img Cache
Image Cache for React Native
Stars: ✭ 724 (+3710.53%)
Mutual labels:  cache
Java Knowledge Mind Map
【🌱🌱Java服务端知识技能图谱】用思维脑图梳理汇总Java服务端知识技能
Stars: ✭ 787 (+4042.11%)
Mutual labels:  cache
Dataloader
Implementation of Facebook's DataLoader in Golang
Stars: ✭ 703 (+3600%)
Mutual labels:  cache
Ngc
NewGoCommand - An opinionated and lightweight project starter. (WORK IN PROGRESS)
Stars: ✭ 16 (-15.79%)
Mutual labels:  tags
Ghostdb
GhostDB is a distributed, in-memory, general purpose key-value data store that delivers microsecond performance at any scale.
Stars: ✭ 690 (+3531.58%)
Mutual labels:  cache
Vimediacache
Cache media file while play media using AVPlayer
Stars: ✭ 758 (+3889.47%)
Mutual labels:  cache
Sup
A curses threads-with-tags style email client (mailing list: [email protected])
Stars: ✭ 780 (+4005.26%)
Mutual labels:  tags
Django Sitecats
Django reusable application for content categorization.
Stars: ✭ 18 (-5.26%)
Mutual labels:  tags
React Native Cached Image
CachedImage component for react-native
Stars: ✭ 890 (+4584.21%)
Mutual labels:  cache

Reflectx GoDoc Go Report Card Build Status

Package reflectx implements extensions to the standard reflect lib suitable for implementing marshalling and unmarshalling packages. The main Mapper type allows for Go-compatible named attribute access, including accessing embedded struct attributes and the ability to use functions and struct tags to customize field names.

This is a standalone version of reflectx package that originates from an SQL row to struct mapper sqlx. We are using it at Scylla gocqlx for scanning of CQL results to structs and slices.

Example

This example demonstrates usage of the reflectx package to automatically bind URL parameters to a request model.

type RequestContext struct {
	SessionID string `http:"sid"`
}

type SearchRequest struct {
	RequestContext
	Labels     []string `http:"l"`
	MaxResults int      `http:"max"`
	Exact      bool     `http:"x"`
}

func Search(w http.ResponseWriter, r *http.Request) {
	// URL /search?sid=id&l=foo&l=bar&max=100&x=true
	if err := r.ParseForm(); err != nil {
		w.WriteHeader(http.StatusBadRequest)
		return
	}
	var data SearchRequest
	if err := bindParams(r, &data); err != nil {
		w.WriteHeader(http.StatusBadRequest)
		return
	}
	log.Printf("%+v", data) // "RequestContext:{SessionID:id} Labels:[foo bar] MaxResults:100 Exact:true}"
}

See the full example in example_test.go.

License

Copyright (C) 2019 ScyllaDB

This project is distributed under the Apache 2.0 license. See the LICENSE file for details. It contains software from:

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].