{"id":22332763,"url":"https://github.com/xgfone/go-cast","last_synced_at":"2025-06-20T10:11:14.837Z","repository":{"id":84532759,"uuid":"263327728","full_name":"xgfone/go-cast","owner":"xgfone","description":"Supply some functions to convert the data between types, such as ToXXX and MustToXXX.","archived":false,"fork":false,"pushed_at":"2024-05-12T14:19:13.000Z","size":75,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-10-30T20:49:04.690Z","etag":null,"topics":["cast","casting","go","go-type","golang","type","type-casting","typecast"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/xgfone.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-05-12T12:18:31.000Z","updated_at":"2024-05-12T12:54:48.000Z","dependencies_parsed_at":"2024-05-12T14:02:46.773Z","dependency_job_id":null,"html_url":"https://github.com/xgfone/go-cast","commit_stats":null,"previous_names":["xgfone/cast"],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xgfone%2Fgo-cast","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xgfone%2Fgo-cast/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xgfone%2Fgo-cast/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xgfone%2Fgo-cast/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xgfone","download_url":"https://codeload.github.com/xgfone/go-cast/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228042086,"owners_count":17860363,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cast","casting","go","go-type","golang","type","type-casting","typecast"],"created_at":"2024-12-04T04:19:38.124Z","updated_at":"2024-12-04T04:19:39.409Z","avatar_url":"https://github.com/xgfone.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Go Type Cast [![Build Status](https://github.com/xgfone/go-cast/actions/workflows/go.yml/badge.svg)](https://github.com/xgfone/go-cast/actions/workflows/go.yml) [![GoDoc](https://pkg.go.dev/badge/github.com/xgfone/go-cast)](https://pkg.go.dev/github.com/xgfone/go-cast) [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg?style=flat-square)](https://raw.githubusercontent.com/xgfone/go-cast/master/LICENSE)\n\nProvide some functions, supporting `Go1.21+`, to convert the value between different types, such as `ToXXX`.\n\n## Installation\n```shell\n$ go get -u github.com/xgfone/go-cast\n```\n\n## API\n\n#### Convert Function\n```go\nfunc ToTime(any interface{}) (dst time.Time, err error)\nfunc ToBool(any interface{}) (dst bool, err error)\nfunc ToInt64(any interface{}) (dst int64, err error)\nfunc ToUint64(any interface{}) (dst uint64, err error)\nfunc ToFloat64(any interface{}) (dst float64, err error)\nfunc ToString(any interface{}) (dst string, err error)\nfunc ToDuration(any interface{}) (dst time.Duration, err error)\n\nfunc ToTimeInLocation(any interface{}, loc *time.Location, layouts ...string) (time.Time, error)\nfunc MustToTimeInLocation(any interface{}, loc *time.Location, layouts ...string) time.Time\nfunc MustParseTime(value string, loc *time.Location, layouts ...string) time.Time\nfunc TryParseTime(value string, loc *time.Location, layouts ...string) (time.Time, error)\nfunc Set(dst, src interface{}) (err error)\n\n// Must is the generic function and used by associating with ToXXX. For example,\n//   Must(ToBool(any))\n//   Must(ToInt64(any))\n//   Must(ToUint64(any))\n//   Must(ToFloat64(any))\n//   Must(ToString(any))\n//   Must(ToDuration(any))\n//   Must(ToTime(any))\nfunc Must[T any](value T, err error) T\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxgfone%2Fgo-cast","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxgfone%2Fgo-cast","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxgfone%2Fgo-cast/lists"}