Popularity
1.9
Declining
Activity
4.6
Declining
18
2
8
Programming language: Go
License: MIT License
Tags:
Utilities
go-type alternatives and similar packages
Based on the "Utilities" category.
Alternatively, view go-types alternatives based on common mentions on social networks and blogs.
-
项目文档
🚀Vite+Vue3+Gin的开发基础平台,支持TS和JS混用。它集成了JWT鉴权、权限管理、动态路由、显隐可控组件、分页封装、多点登录拦截、资源权限、上传下载、代码生成器【可AI辅助】、表单生成器和可配置的导入导出等开发必备功能。 -
excelize
Go language library for reading and writing Microsoft Excel™ (XLAM / XLSM / XLSX / XLTM / XLTX) spreadsheets -
Kopia
Cross-platform backup tool for Windows, macOS & Linux with fast, incremental backups, client-side end-to-end encryption, compression and data deduplication. CLI and GUI included. -
goreporter
A Golang tool that does static analysis, unit testing, code review and generate code quality report. -
create-go-app
✨ A complete and self-contained solution for developers of any qualification to create a production-ready project with backend (Go), frontend (JavaScript, TypeScript) and deploy automation (Ansible, Docker) by running only one CLI command. -
EaseProbe
A simple, standalone, and lightweight tool that can do health/status checking, written in Go. -
filetype
Fast, dependency-free Go package to infer binary file types based on the magic numbers header signature -
boilr
:zap: boilerplate template manager that generates files or directories from template repositories -
beaver
💨 A real time messaging system to build a scalable in-app notifications, multiplayer games, chat apps in web and mobile apps. -
go-underscore
Helpfully Functional Go - A useful collection of Go utilities. Designed for programmer happiness.
InfluxDB - Purpose built for real-time analytics at any scale.
InfluxDB Platform is powered by columnar analytics, optimized for cost-efficient storage, and built with open data standards.
Promo
www.influxdata.com
Do you think we are missing an alternative of go-type or a related project?
Popular Comparisons
README
go-types
This library has been created with the purpose to facilitate the store, validation, and transfer of Go ISO-3166/ISO-4217/timezones/emails/URL types. There is a openapi3 spec of that type and make you able to include it into your spec. All types has own ozzo.Validate, json.Unmarshaler, Stringer and driver.Valuer implementations.
Installation
go get github.com/mikekonan/go-types/v2
Usage:
package main
import (
"encoding/json"
"fmt"
"log"
validation "github.com/go-ozzo/ozzo-validation/v4"
"github.com/mikekonan/go-types/v2/country"
"github.com/mikekonan/go-types/v2/country/alpha2"
"github.com/mikekonan/go-types/v2/country/alpha3"
"github.com/mikekonan/go-types/v2/language"
"github.com/mikekonan/go-types/v2/country/name"
"github.com/mikekonan/go-types/v2/currency"
"github.com/mikekonan/go-types/v2/currency/code"
"github.com/mikekonan/go-types/v2/phone"
"github.com/mikekonan/go-types/v2/postal_code"
)
// 1. use in your structs
type User struct {
Name string `json:"name" db:"name"`
Country country.Alpha2Code `json:"country" db:"country"`
Currency currency.Code `json:"currency" db:"currency"`
Language language.Alpha2Code `json:"language" db:"language"`
Phone phone.Number `json:"phone" db:"phone"`
CountryDialCode phone.DialCode `json:"dialCode" db:"dialCode"`
PostalCode postalcode.PostalCode `json:"postalCode" db:"postalCode"`
}
func main() {
// 2. use in your wire
user := User{}
_ = json.Unmarshal([]byte(`{"name":"name", "country": "CA", "currency": "CAD", "language": "fr", "phone": "123456789", "dialCode": "1"}`), &user)
// 3. check is set
user.Country.IsSet()
user.Currency.IsSet()
user.Language.IsSet()
// 4. validate using ozzo-validation
if err := validation.ValidateStruct(&user, validation.Field(&user.Country), validation.Field(&user.Currency)); err != nil {
log.Fatal(err)
}
// 5. lookup by alpha2, alpha3, country name
if userCountry, ok := country.ByAlpha2Code(user.Country); ok {
fmt.Printf("country name - '%s', alpha-2 - '%s', alpha-3 - '%s'", userCountry.Name(), userCountry.Alpha2Code(), userCountry.Alpha3Code())
}
// 6. lookup by 2 and 3 char codes, language name
if userLanguage, ok := language.ByAlpha2Code(user.Language); ok {
fmt.Printf("language name - '%s', alpha-2 - '%s', alpha-3 - '%s'", userLanguage.Name(), userLanguage.Alpha2Code(), userLanguage.Alpha3Code())
}
// 7. lookup by country dial code
if phoneCountries, ok := phone.CountriesByDialCode(user.CountryDialCode); ok {
for _, phoneCountry := range phoneCountries {
fmt.Printf("country by dial code - '%s'", phoneCountry)
}
}
// 8. lookup by country
if dialCode, ok := phone.DialByAlpha2Code(user.Country); ok {
fmt.Printf("'%s' dial code is '%s'", user.Country, dialCode)
}
// 9. lookup by currency code
if userCurrency, ok := currency.ByCode(user.Currency); ok {
fmt.Printf("currency name - '%s', code - '%s', number - '%s', countries - '%s', decimal places - '%d'",
userCurrency.Currency(), userCurrency.Code(), userCurrency.Number(), userCurrency.Countries(), userCurrency.DecimalPlaces())
}
// 10. store in db
fmt.Println(user.Country.Value()) //prints 'CA'
fmt.Println(user.Currency.Value()) //prints 'CAN'
fmt.Println(user.Language.Value()) //prints 'fr'
// 11. use specific country constants
fmt.Println(country.Canada.Alpha2Code())
fmt.Println("name:", name.Canada)
fmt.Println("alpha-2:", alpha2.CA)
fmt.Println("alpha-3:", alpha3.CAN)
// 12. use specific currency codes
fmt.Println(code.CAD)
}
Links:
- Currency Codes (ISO 4217) - wiki
- Country Codes (ISO 3166) - wiki
- URL(including HttpURL) (standard) - wiki
- Email (part of RFC5322) - wiki
- Timezone (RFC6557 IANA timezones) - wiki
- Languages (ISO 639-1) - wiki; (ISO 639-2) - wiki
- Country Dial Codes (E.164) - wiki