{"record":{"id":"e83e857d6256608e","repo":"kataras/iris","slug":"iso8601-unknown-type-of-t","errorCode":null,"errorMessage":"ISO8601: unknown type of: %T","messagePattern":"ISO8601: unknown type of: %T","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"x/jsonx/iso8601.go","lineNumber":397,"sourceCode":"func (t *ISO8601) Scan(src any) error {\n\tswitch v := src.(type) {\n\tcase time.Time: // type was set to timestamp\n\t\tif v.IsZero() {\n\t\t\treturn nil // don't set zero, ignore it.\n\t\t}\n\t\t*t = ISO8601(v)\n\tcase string:\n\t\ttt, err := ParseISO8601(v)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\t*t = tt\n\tcase []byte:\n\t\treturn t.Scan(string(v))\n\tcase nil:\n\t\t*t = ISO8601(time.Time{})\n\tdefault:\n\t\treturn fmt.Errorf(\"ISO8601: unknown type of: %T\", v)\n\t}\n\n\treturn nil\n}\n\n// parseSignedOffset parses a signed timezone offset (e.g. \"+03\" or \"-04\").\n// The function checks for a signed number in the range -23 through +23 excluding zero.\n// Returns length of the found offset string or 0 otherwise.\n//\n// Language internal function.\nfunc parseSignedOffset(value string) int {\n\tsign := value[0]\n\tif sign != '-' && sign != '+' {\n\t\treturn 0\n\t}\n\tx, rem, err := leadingInt(value[1:])\n\n\t// fail if nothing consumed by leadingInt","sourceCodeStart":379,"sourceCodeEnd":415,"githubUrl":"https://github.com/kataras/iris/blob/7bedaf55a0b64bbb2248a5845a2c60d81a30996a/x/jsonx/iso8601.go#L379-L415","documentation":"ISO8601 implements sql.Scanner; Scan dispatches on the runtime type of the database driver's src value. Supported types are string, []byte, time.Time, and nil. This error is returned when the driver hands Scan a value of any other type, so the library cannot convert it into an ISO8601 time.","triggerScenarios":"Calling (*ISO8601).Scan(src) with src whose concrete type is not time.Time, string, []byte, or nil — e.g. an int64 from a BIGINT column, float64, or a driver-specific type.","commonSituations":"Binding an ISO8601 field to a non-temporal SQL column (integer epoch, numeric); custom drivers returning exotic types; scanning raw query results with mismatched column types.","solutions":["Change the SQL column/query to return a timestamp, text, or bytea type the scanner supports (e.g. SELECT to_timestamp(epoch) instead of raw epoch).","Convert the value in SQL (e.g. epoch::text) or in code before calling Scan.","Use a custom wrapper type that converts int64 epoch values to time.Time and delegates to ISO8601."],"exampleFix":"// before\nvar t jsonx.ISO8601\nrows.Scan(&t) // BIGINT column -> ISO8601: unknown type of: int64\n// after\nvar epoch int64\nrows.Scan(&epoch)\nt = jsonx.ISO8601(time.Unix(epoch, 0).UTC())","handlingStrategy":"type-guard","validationCode":"func scanSrcSupported(src any) bool {\n\tswitch src.(type) {\n\tcase nil, string, []byte, time.Time:\n\t\treturn true\n\tdefault:\n\t\treturn false\n\t}\n}","typeGuard":"func isScannableIntoISO8601(src any) bool {\n\tswitch src.(type) {\n\tcase nil, string, []byte, time.Time:\n\t\treturn true\n\t}\n\treturn false\n}","tryCatchPattern":"var t jsonx.ISO8601\nif err := rows.Scan(&t); err != nil {\n\tif strings.Contains(err.Error(), \"unknown type of\") {\n\t\treturn fmt.Errorf(\"column is not a timestamp/text type; convert it in SQL: %w\", err)\n\t}\n\treturn err\n}","preventionTips":["Bind ISO8601 fields only to timestamp, text, or bytea columns.","Convert epoch integers with to_timestamp() / time.Unix before scanning.","Inspect column types of raw queries before assigning scanner types."],"tags":["sql","scanner","type-mismatch","go"],"backgroundTag":"unsupported-scan-type","analyzedSha":"7bedaf55a0b64bbb2248a5845a2c60d81a30996a","analyzedAt":"2026-08-30T20:38:16.250Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}