
Security News
pnpm 10.12 Introduces Global Virtual Store and Expanded Version Catalogs
pnpm 10.12.1 introduces a global virtual store for faster installs and new options for managing dependencies with version catalogs.
github.com/liquid-labs/go-nullable-mysql
Enhanced support of NULL
values in JSON marshalling and unmarshalling for MySQL datatypes in Go. I.e., SQL NULL
<-> JSON null
. Also, add support for MySQL DATE
types.
import (
...
"database/sql"
"time"
"github.com/Liquid-Labs/go-nullable-mysql/nulls"
)
type Foo struct {
ADate nulls.Date `json:"aDate"`
ATimestamp nulls.Timestamp `json:"aTime"`
}
func SaveData(foo *Foo) (error) {
_, err := insertFooStmt.Exec(foo.ADate, foo.ATimestamp)
...
}
func ScanFoo(row sql.Row) (*Foo, error) {
foo := Foo{}
if err := row.Scan(&foo.ADate, &foo.ATimestamp); err != nil {
return nil, err
}
return &foo, nil
}
func MakeFoo(dateString string, time time.timeStamp) (Foo) {
return Foo{nulls.NewDate(dateString), nulls.NewTimestamp(time)}
}
Supported types are:
NullBool
- a MySQL BOOL
(==TINYINT(1)
) <-> golang bool
NullDate
- a MySQL DATE
<-> golang string
in 'YYYY-MM-DD' formatNullFloat64
- a MySQL DOUBLE
(or FLOAT
if you like) <-> golang float64
NullInt64
- a MySQL INT
<-> golang int64
NullString
- a MySQL VARCHAR
, CHAR
, TEXT
, etc. <-> golang string
NullTimestamp
- a MySQL TIMESTAMP
<-> golang time.Time
FAQs
Unknown package
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
pnpm 10.12.1 introduces a global virtual store for faster installs and new options for managing dependencies with version catalogs.
Security News
Amaro 1.0 lays the groundwork for stable TypeScript support in Node.js, bringing official .ts loading closer to reality.
Research
A deceptive PyPI package posing as an Instagram growth tool collects user credentials and sends them to third-party bot services.