Documentation
¶
Overview ¶
копия файла из https://github.com/jackc/pgtype/timestamptz.go чтоб не выдавала ошибку на null чтобы дата NULL = time.Time{}
Index ¶
- Constants
- Variables
- func AppendInt16(buf []byte, n int16) []byte
- func AppendInt32(buf []byte, n int32) []byte
- func AppendInt64(buf []byte, n int64) []byte
- func AppendUint16(buf []byte, n uint16) []byte
- func AppendUint32(buf []byte, n uint32) []byte
- func AppendUint64(buf []byte, n uint64) []byte
- func CloseConnection()
- func CloseConnection_err() error
- func Connect()
- func Connect_WithApplicationName(ApplicationName string)
- func Connect_WithApplicationName_err(ApplicationName string) error
- func Connect_err() error
- func FillSettings()
- func GetConnection() *pgx.Conn
- func GetConnectionString(ApplicationName string) string
- func GetConnection_WithApplicationName(ApplicationName string) *pgx.Conn
- func IsClosed() bool
- func LogInfo_Connected(err error)
- func Ping_err(ctxMain context.Context) error
- func RawMultipleSQL(tx IConnectionTransaction, TextSQL string) (pgx.Rows, error)
- func Reconnect(err error)
- func SetInt32(buf []byte, n int32)
- func Start(ApplicationName string)
- func StartDB()
- func Start_ctx(ctx *context.Context, WaitGroup *sync.WaitGroup) error
- func WaitStop()
- type IConnectionTransaction
- type SettingsINI
- type Timestamptz
- func (tstz Timestamptz) MarshalJSON() ([]byte, error)
- func (tstz *Timestamptz) Scan(src any) error
- func (tstz *Timestamptz) ScanTimestamptz(v Timestamptz) error
- func (tstz Timestamptz) TimestamptzValue() (Timestamptz, error)
- func (tstz *Timestamptz) UnmarshalJSON(b []byte) error
- func (tstz Timestamptz) Value() (driver.Value, error)
- type TimestamptzCodec
- func (c *TimestamptzCodec) DecodeDatabaseSQLValue(m *pgtype.Map, oid uint32, format int16, src []byte) (driver.Value, error)
- func (c *TimestamptzCodec) DecodeValue(m *pgtype.Map, oid uint32, format int16, src []byte) (any, error)
- func (*TimestamptzCodec) FormatSupported(format int16) bool
- func (*TimestamptzCodec) PlanEncode(m *pgtype.Map, oid uint32, format int16, value any) pgtype.EncodePlan
- func (c *TimestamptzCodec) PlanScan(m *pgtype.Map, oid uint32, format int16, target any) pgtype.ScanPlan
- func (*TimestamptzCodec) PreferredFormat() int16
Constants ¶
const TextConnBusy = "conn busy"
TextConnBusy - текст ошибки "conn busy"
Variables ¶
var Conn *pgx.Conn
Conn - соединение к базе данных
var NeedReconnect bool
NeedReconnect - флаг необходимости переподключения
var Settings = SettingsINI{}
Settings хранит все нужные переменные окружения
Functions ¶
func AppendInt16 ¶ added in v1.0.200
func AppendInt32 ¶ added in v1.0.200
func AppendInt64 ¶ added in v1.0.200
func AppendUint16 ¶ added in v1.0.200
func AppendUint32 ¶ added in v1.0.200
func AppendUint64 ¶ added in v1.0.200
func CloseConnection_err ¶
func CloseConnection_err() error
CloseConnection - закрытие соединения с базой данных
func Connect_WithApplicationName ¶ added in v1.0.187
func Connect_WithApplicationName(ApplicationName string)
Connect_WithApplicationName - подключается к базе данных, с указанием имени приложения
func Connect_WithApplicationName_err ¶
Connect_WithApplicationName_err - подключается к базе данных, с указанием имени приложения
func FillSettings ¶
func FillSettings()
FillSettings загружает переменные окружения в структуру из файла или из переменных окружения
func GetConnection ¶
GetConnection - возвращает соединение к нужной базе данных
func GetConnectionString ¶
GetConnectionString - возвращает строку соединения к базе данных
func GetConnection_WithApplicationName ¶
GetConnection_WithApplicationName - возвращает соединение к нужной базе данных, с указанием имени приложения
func LogInfo_Connected ¶ added in v1.0.58
func LogInfo_Connected(err error)
LogInfo_Connected - выводит сообщение в Лог, или паника при ошибке
func RawMultipleSQL ¶ added in v1.0.18
func RawMultipleSQL(tx IConnectionTransaction, TextSQL string) (pgx.Rows, error)
func Reconnect ¶
func Reconnect(err error)
Reconnect повторное подключение к базе данных, если оно отключено или полная остановка программы
Types ¶
type IConnectionTransaction ¶ added in v1.0.197
type IConnectionTransaction interface {
// Transaction management
Begin(ctx context.Context) (pgx.Tx, error)
// Query execution
Exec(ctx context.Context, sql string, arguments ...any) (pgconn.CommandTag, error)
Query(ctx context.Context, sql string, args ...any) (pgx.Rows, error)
QueryRow(ctx context.Context, sql string, args ...any) pgx.Row
// Batch operations
SendBatch(ctx context.Context, b *pgx.Batch) pgx.BatchResults
// Bulk copy operations
CopyFrom(ctx context.Context, tableName pgx.Identifier, columnNames []string, rowSrc pgx.CopyFromSource) (int64, error)
}
IConnectionTransaction - интерфейс для работы с базой данных объединяет в себе функции pgx.Conn, pgxpool.Pool и pgx.Tx чтобы передавать в функцию любой их них
type SettingsINI ¶
type SettingsINI struct {
DB_HOST string
DB_PORT string
DB_NAME string
DB_SCHEMA string
DB_USER string
DB_PASSWORD string
}
SettingsINI - структура для хранения всех нужных переменных окружения
type Timestamptz ¶ added in v1.0.200
type Timestamptz struct {
Time time.Time
InfinityModifier pgtype.InfinityModifier
Valid bool
}
Timestamptz represents the PostgreSQL timestamptz type.
func (Timestamptz) MarshalJSON ¶ added in v1.0.200
func (tstz Timestamptz) MarshalJSON() ([]byte, error)
func (*Timestamptz) Scan ¶ added in v1.0.200
func (tstz *Timestamptz) Scan(src any) error
Scan implements the database/sql Scanner interface.
func (*Timestamptz) ScanTimestamptz ¶ added in v1.0.200
func (tstz *Timestamptz) ScanTimestamptz(v Timestamptz) error
func (Timestamptz) TimestamptzValue ¶ added in v1.0.200
func (tstz Timestamptz) TimestamptzValue() (Timestamptz, error)
func (*Timestamptz) UnmarshalJSON ¶ added in v1.0.200
func (tstz *Timestamptz) UnmarshalJSON(b []byte) error
type TimestamptzCodec ¶ added in v1.0.200
type TimestamptzCodec struct {
// ScanLocation is the location to return scanned timestamptz values in. This does not change the instant in time that
// the timestamptz represents.
ScanLocation *time.Location
}
func (*TimestamptzCodec) DecodeDatabaseSQLValue ¶ added in v1.0.200
func (*TimestamptzCodec) DecodeValue ¶ added in v1.0.200
func (*TimestamptzCodec) FormatSupported ¶ added in v1.0.200
func (*TimestamptzCodec) FormatSupported(format int16) bool
func (*TimestamptzCodec) PlanEncode ¶ added in v1.0.200
func (*TimestamptzCodec) PlanEncode(m *pgtype.Map, oid uint32, format int16, value any) pgtype.EncodePlan
func (*TimestamptzCodec) PreferredFormat ¶ added in v1.0.200
func (*TimestamptzCodec) PreferredFormat() int16