Skip to main content
Version: 2.8.x(Latest)

Introduction

The GoFrame framework provides a very powerful and easy-to-use type conversion package gconv, which can convert common data types into specified data types, seamlessly converting between common basic data types, and also supports conversion of any type to a struct object. Since the gconv module internally prioritizes the use of assertions over reflection, the execution efficiency is very high.

Notes:

The primary goal of the gconv package is to provide simple and efficient type conversion functionality. Developers should be aware of the input parameters for the conversion and the current business scenario being used. If some methods fail to convert, the method will not return the reason for the error, nor will it cause a panic, but will directly return the value after the conversion fails. Therefore, developers often need to comprehensively judge the correctness of the result based on the return value and the current business scenario.

Usage:

import "github.com/gogf/gf/v2/util/gconv"

API Documentation:

https://pkg.go.dev/github.com/gogf/gf/v2/util/gconv

Method List:

The method list may lag behind the code, please refer to the API documentation for details.

Documentation