textra alternatives and similar packages
Based on the "Go Tools" category.
Alternatively, view textra alternatives based on common mentions on social networks and blogs.
-
The Go Play Space
Advanced Go Playground frontend written in Go, with syntax highlighting, turtle graphics mode, and more -
Sonic
Sonic is a Go library for network and I/O programming that provides developers with a consistent asynchronous model, with a focus on achieving the lowest possible latency and jitter in Go. -
typex
[TOOL/CLI] - Filter and examine Go type structures, interfaces and their transitive dependencies and relationships. Export structural types as TypeScript value object or bare type representations. -
Viney's go-cache
A flexible multi-layer Go caching library to deal with in-memory and shared cache by adopting Cache-Aside pattern. -
gothanks
GoThanks automatically stars Go's official repository and your go.mod github dependencies, providing a simple way to say thanks to the maintainers of the modules you use and the contributors of Go itself. -
go-lock
go-lock is a lock library implementing read-write mutex and read-write trylock without starvation -
goroutines
It is an efficient, flexible, and lightweight goroutine pool. It provides an easy way to deal with concurrent tasks with limited resource. -
PDF to Image Converter Using Golang
This project will help you to convert PDF file to IMAGE using golang. -
go-james
DISCONTINUED. James is your butler and helps you to create, build, debug, test and run your Go projects -
docs
Automatically generate RESTful API documentation for GO projects - aligned with Open API Specification standard -
rescached
DISCONTINUED. [mirror] Resolver (DNS) cache daemon. See https://sr.ht/~shulhan/rescached [Moved to: https://github.com/shuLhan/rescached] -
modver
Compare two versions of a Go module to check the version-number change required (major, minor, or patchlevel), according to semver rules. -
channelize
A websocket framework to manage outbound streams. Allowing to have multiple channels per connection that includes public and private channels.
InfluxDB - Purpose built for real-time analytics at any scale.
* Code Quality Rankings and insights are calculated and provided by Lumnify.
They vary from L1 to L5 with "L5" being the highest.
Do you think we are missing an alternative of textra or a related project?
README
Textra
Textra is a simple and fast tag extractor package that helps to work with structs tags. It also has json tags for all structs, in case of JSON output.
Initially I built it for another private project, but decided to try to open-source it, since it could be useful in some use-cases. Because of that it has some features that feels redundant, like having field type as a part of returned data
Documentation
Installation
go get github.com/Ravcii/textra
Examples
Basic usage:
type Tester struct {
NoTags bool
WithTag string `json:"with_tag,omitempty"`
WithTags string `json:"with_tags" sql:"with_tag"`
SqlOnly string `sql:"sql_only"`
}
func main() {
fields := textra.Extract((*Tester)(nil))
for _, field := range fields {
fmt.Println(field)
}
}
NoTags(bool):[]
WithTag(string):[json:"with_tag,omitempty"]
WithTags(string):[json:"with_tags" sql:"with_tag"]
SqlOnly(string):[sql:"sql_only"]
You can look at return types at go.doc, basically it returns a slice of fields with its types (as strings) and a slice of Tags for each field.
Now let's apply some functions:
fields := textra.Extract((*Tester)(nil)).RemoveEmpty()
WithTag(string):[json:"with_tag,omitempty"]
WithTags(string):[json:"with_tags" sql:"with_tag"]
SqlOnly(string):[sql:"sql_only"]
What if we care only about SQL tags?
fields := textra.Extract((*Tester)(nil)).RemoveEmpty().Only("sql")
{WithTags string sql:"with_tag"}
{SqlOnly string sql:"sql_only"}
Only() is a bit special as it returns a Field of a different type, with Tag
rather than Tags
Although it may be redundant, it also parses types a their string representation (for easier comparsion or output, if you need it)
type Types struct {
intType int
byteType byte
runeType rune
stringType string
booleanType bool
sliceStringType []string
mapType map[string]string
chanType chan int
funcType func() error
importType time.Time
pointerType *string
}
func main() {
fields := textra.Extract((*Types)(nil))
for _, field := range fields {
fmt.Println(field.Name, field.Type)
}
}
intType int
byteType uint8
runeType int32
stringType string
booleanType bool
sliceStringType slice
mapType map
chanType chan
funcType func
importType time.Time
pointerType *string
TODO
- [x] Better README.md (i hope)
- [x] Add blacklisting (RemoveFields)
- [ ] Examples for go.dev
- [x] Some sugar for common tags
- [x] ByName to get tag for each field
- [x] Omitempty for "*,omitempty"
- [x] Ignored for "-"
- [x] Better string representation
- [ ] ...?