Documentation
¶
Index ¶
- Constants
- Variables
- func ByteToBool(b byte) bool
- func ColumnIndexToColumnToValueNew(typ2cfg2conv TypeToConfigToConverter, cfg PgColumnConverterConfig, ...) func(int16, PgColumn) IO[sw.Value]
- func ColumnIndexToColumnToValueNewDefault(indices []int16, index2type IndexToType) func(int16, PgColumn) IO[sw.Value]
- func ColumnIndexToColumnToValueNewDefaultFromMap(ix2typMap map[int16]rs.PrimitiveType) func(int16, PgColumn) IO[sw.Value]
- func ColumnInfoMapFromIter(i iter.Seq2[ColumnInfo, error]) map[int16]ColumnInfo
- func ColumnMapToPgRows(colmap map[int16]ColumnInfo) func(iter.Seq2[PgRow, error]) IO[iter.Seq2[map[string]sw.Value, error]]
- func FilenameToColumnInfoMap(filename string) IO[map[int16]ColumnInfo]
- func JoinedNamesToNameResolverMap(split string, joined string) map[int16]string
- func JsonsFilenameToColumnInfo(filename string) iter.Seq2[ColumnInfo, error]
- func JsonsToColumnInfo(jsons io.Reader) iter.Seq2[ColumnInfo, error]
- func MapGetOrInsert[K comparable, V any](m map[K]V, key K, onMissing func() V) V
- func NamesToNameResolverMap(names iter.Seq[string]) map[int16]string
- func NullableMap[T, U any](input sql.Null[T], convert func(T) U) sql.Null[U]
- func PgRowsToValues(ctx context.Context, rows iter.Seq2[PgRow, error], ...) iter.Seq2[map[string]sw.Value, error]
- func PgRowsToValuesFromColumnMap(ctx context.Context, rows iter.Seq2[PgRow, error], colmap map[int16]ColumnInfo) iter.Seq2[map[string]sw.Value, error]
- func ReaderToPgRows(rdr io.Reader) iter.Seq2[PgRow, error]
- func StdinToPgRows() iter.Seq2[PgRow, error]
- type ColumnIndexToCol2Val
- type ColumnIndexToColumnName
- type ColumnInfo
- type ColumnInfoRaw
- type ConfigToConverter
- type IndexToType
- type PgColumn
- func (p PgColumn) IsNull() bool
- func (p PgColumn) String() string
- func (p PgColumn) ToBytes() []byte
- func (p PgColumn) ToNullableBoolean() (sql.Null[bool], error)
- func (p PgColumn) ToNullableDouble() (sql.Null[float64], error)
- func (p PgColumn) ToNullableDword() (sql.Null[uint32], error)
- func (p PgColumn) ToNullableFloat() (sql.Null[float32], error)
- func (p PgColumn) ToNullableInt() (sql.Null[int32], error)
- func (p PgColumn) ToNullableLong() (sql.Null[int64], error)
- func (p PgColumn) ToNullableQword() (sql.Null[uint64], error)
- func (p PgColumn) ToNullableShortInt() (sql.Null[int32], error)
- func (p PgColumn) ToNullableString(checker func(string) error, buf *strings.Builder) (sql.Null[string], error)
- func (p PgColumn) ToNullableTime() (sql.Null[time.Time], error)
- func (p PgColumn) ToNullableUuid() (sql.Null[uuid.UUID], error)
- func (p PgColumn) ToNullableWord() (sql.Null[uint16], error)
- func (p PgColumn) ToValueBoolean() sw.Value
- func (p PgColumn) ToValueBytes() sw.Value
- func (p PgColumn) ToValueDouble() sw.Value
- func (p PgColumn) ToValueFloat() sw.Value
- func (p PgColumn) ToValueInt() sw.Value
- func (p PgColumn) ToValueLong() sw.Value
- func (p PgColumn) ToValueNull() sw.Value
- func (p PgColumn) ToValueNullBoolean() sw.Value
- func (p PgColumn) ToValueNullBytes() sw.Value
- func (p PgColumn) ToValueNullDouble() sw.Value
- func (p PgColumn) ToValueNullFloat() sw.Value
- func (p PgColumn) ToValueNullInt() sw.Value
- func (p PgColumn) ToValueNullLong() sw.Value
- func (p PgColumn) ToValueNullString(checker func(string) error, buf *strings.Builder) sw.Value
- func (p PgColumn) ToValueNullTime() sw.Value
- func (p PgColumn) ToValueNullUuid() sw.Value
- func (p PgColumn) ToValueString(checker func(string) error, buf *strings.Builder) sw.Value
- func (p PgColumn) ToValueTime() sw.Value
- func (p PgColumn) ToValueUuid() sw.Value
- type PgColumnConverterConfig
- type PgColumnToValue
- type PgRow
- type StringChecker
- type TypeToConfigToConverter
- type TypeToConverterMap
Constants ¶
View Source
const PgtimeOffset int64 = 10957 * 86400 * 1000 * 1000
Variables ¶
View Source
var ( ErrColumnNameNotFound error = errors.New("column name not found") ErrInvalidWord error = errors.New("invalid word") ErrInvalidQword error = errors.New("invalid qword") ErrInvalidDword error = errors.New("invalid dword") ErrMayBeWord error = errors.New("invalid dword: may be word") ErrInvalidBool error = errors.New("invalid bool") ErrUnexpectedNull error = errors.New("unexpected null") ErrConvGenMissing error = errors.New("converter creator missing") ErrConverterMissing error = errors.New("converter missing") ErrInvalidUuid error = errors.New("invalid uuid") )
View Source
var JoinedNamesToNameResolverMapDefault func( string, ) map[int16]string = Curry(JoinedNamesToNameResolverMap)(",")
View Source
var JsonsFilenameToColumnInfoMap func(string) map[int16]ColumnInfo = Compose( JsonsFilenameToColumnInfo, ColumnInfoMapFromIter, )
View Source
var MapToNameResolver func(map[int16]string) func(int16) (string, error) = rs. GetValueByKeyFromMap[int16, string]( func(ix int16) error { return fmt.Errorf("%w: %v", ErrColumnNameNotFound, ix) }, )
View Source
var PgRowsFromStdin IO[iter.Seq2[PgRow, error]] = OfFn(StdinToPgRows)
Functions ¶
func ByteToBool ¶
func ColumnIndexToColumnToValueNew ¶
func ColumnIndexToColumnToValueNew( typ2cfg2conv TypeToConfigToConverter, cfg PgColumnConverterConfig, indices []int16, index2type IndexToType, ) func(int16, PgColumn) IO[sw.Value]
func ColumnInfoMapFromIter ¶
func ColumnInfoMapFromIter( i iter.Seq2[ColumnInfo, error], ) map[int16]ColumnInfo
func ColumnMapToPgRows ¶
func FilenameToColumnInfoMap ¶
func FilenameToColumnInfoMap(filename string) IO[map[int16]ColumnInfo]
func JsonsFilenameToColumnInfo ¶
func JsonsFilenameToColumnInfo( filename string, ) iter.Seq2[ColumnInfo, error]
func JsonsToColumnInfo ¶
func MapGetOrInsert ¶
func MapGetOrInsert[K comparable, V any]( m map[K]V, key K, onMissing func() V, ) V
func NamesToNameResolverMap ¶
func PgRowsToValues ¶
Types ¶
type ColumnIndexToCol2Val ¶
type ColumnIndexToCol2Val func(int16) PgColumnToValue
type ColumnIndexToColumnName ¶
type ColumnInfo ¶
type ColumnInfo struct { Name string rs.PrimitiveType }
func ColumInfoNew ¶
func ColumInfoNew(name string, typeString string) (ColumnInfo, error)
type ColumnInfoRaw ¶
func (ColumnInfoRaw) ToColumnInfo ¶
func (r ColumnInfoRaw) ToColumnInfo() (ColumnInfo, error)
type ConfigToConverter ¶
type ConfigToConverter func(PgColumnConverterConfig) PgColumnToValue
type IndexToType ¶
type IndexToType func(int16) rs.PrimitiveType
func MapToIndexToType ¶
func MapToIndexToType(m map[int16]rs.PrimitiveType) IndexToType
type PgColumn ¶
func (PgColumn) ToNullableShortInt ¶
func (PgColumn) ToNullableString ¶
func (PgColumn) ToValueBoolean ¶
func (PgColumn) ToValueBytes ¶
func (PgColumn) ToValueDouble ¶
func (PgColumn) ToValueFloat ¶
func (PgColumn) ToValueInt ¶
func (PgColumn) ToValueLong ¶
func (PgColumn) ToValueNull ¶
func (PgColumn) ToValueNullBoolean ¶
func (PgColumn) ToValueNullBytes ¶
func (PgColumn) ToValueNullDouble ¶
func (PgColumn) ToValueNullFloat ¶
func (PgColumn) ToValueNullInt ¶
func (PgColumn) ToValueNullLong ¶
func (PgColumn) ToValueNullString ¶
func (PgColumn) ToValueNullTime ¶
func (PgColumn) ToValueNullUuid ¶
func (PgColumn) ToValueString ¶
func (PgColumn) ToValueTime ¶
func (PgColumn) ToValueUuid ¶
type PgColumnConverterConfig ¶
type PgColumnConverterConfig struct{ StringChecker }
var PgColumnConverterConfigDefault PgColumnConverterConfig = PgColumnConverterConfig{ StringChecker: StringCheckerTrusted, }
type PgColumnToValue ¶
type StringChecker ¶
var StringCheckerTrusted StringChecker = func(_ string) error { return nil }
type TypeToConfigToConverter ¶
type TypeToConfigToConverter func(rs.PrimitiveType) (ConfigToConverter, error)
var TypeToConvGen TypeToConfigToConverter = rs. GetValueByKeyFromMap[rs.PrimitiveType, ConfigToConverter]( func(typ rs.PrimitiveType) error { return fmt.Errorf("%w: %v", ErrConvGenMissing, typ) }, )(type2convGenMap)
type TypeToConverterMap ¶
type TypeToConverterMap map[rs.PrimitiveType]ConfigToConverter
Source Files
¶
Click to show internal directories.
Click to hide internal directories.