MCPcopy Index your code
hub / github.com/sqlc-dev/sqlc / convertFuncCastExpr

Method convertFuncCastExpr

internal/engine/dolphin/convert.go:1000–1017  ·  view source on GitHub ↗
(n *pcast.FuncCastExpr)

Source from the content-addressed store, hash-verified

998}
999
1000func (c *cc) convertFuncCastExpr(n *pcast.FuncCastExpr) ast.Node {
1001 typeName := types.TypeStr(n.Tp.GetType())
1002
1003 // MySQL CAST AS UNSIGNED/SIGNED uses bigint internally.
1004 // We need to preserve the signed/unsigned info for formatting.
1005 if typeName == "bigint" {
1006 if mysql.HasUnsignedFlag(n.Tp.GetFlag()) {
1007 typeName = "bigint unsigned"
1008 } else {
1009 typeName = "bigint signed"
1010 }
1011 }
1012
1013 return &ast.TypeCast{
1014 Arg: c.convert(n.Expr),
1015 TypeName: &ast.TypeName{Name: typeName},
1016 }
1017}
1018
1019func (c *cc) convertGetFormatSelectorExpr(n *pcast.GetFormatSelectorExpr) ast.Node {
1020 return todo(n)

Callers 1

convertMethod · 0.95

Calls 2

convertMethod · 0.95
GetTypeMethod · 0.45

Tested by

no test coverage detected