{"id":20731553,"url":"https://github.com/datumbrain/nulltypes","last_synced_at":"2025-04-23T22:05:43.554Z","repository":{"id":56494081,"uuid":"303608712","full_name":"datumbrain/nulltypes","owner":"datumbrain","description":"GORM null-types JSON marshalling and unmarshalling mixins.","archived":false,"fork":false,"pushed_at":"2024-09-03T09:01:35.000Z","size":17,"stargazers_count":17,"open_issues_count":1,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-23T22:05:37.170Z","etag":null,"topics":["hacktoberfest"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/datumbrain.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-10-13T06:28:11.000Z","updated_at":"2024-11-20T14:37:01.000Z","dependencies_parsed_at":"2022-08-15T19:50:23.259Z","dependency_job_id":null,"html_url":"https://github.com/datumbrain/nulltypes","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/datumbrain%2Fnulltypes","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/datumbrain%2Fnulltypes/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/datumbrain%2Fnulltypes/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/datumbrain%2Fnulltypes/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/datumbrain","download_url":"https://codeload.github.com/datumbrain/nulltypes/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250522300,"owners_count":21444511,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["hacktoberfest"],"created_at":"2024-11-17T05:15:47.199Z","updated_at":"2025-04-23T22:05:43.270Z","avatar_url":"https://github.com/datumbrain.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# nulltypes  [![Build Status](https://api.travis-ci.com/datumbrain/nulltypes.svg?branch=master)](https://travis-ci.com/github/datumbrain/nulltypes) [![Go Report Card](https://goreportcard.com/badge/github.com/datumbrain/nulltypes)](https://goreportcard.com/report/github.com/datumbrain/nulltypes) ![License](https://img.shields.io/badge/license-MIT-blue.svg)\n\n\u003cimg align=\"right\" src=\"https://github.com/ashleymcnamara/gophers/raw/master/MovingGopher.png\" width=\"120\"\u003e\n\n`nulltypes` is a golang module that provides an alternative to nullable data types from `database/sql` with proper JSON marshalling and unmarshalling.\n\nIt also provides a wrapper for `time.Time` to format time to use with `timestamp` of SQL databases, i.e. `mysql`, `postgres`.\n\nThe default database time zone is set to `UTC`, but it can easily be changed with:\n\n```go\nnulltypes.DatabaseLocation, _ = time.LoadLocation([YOUR_TIME_ZONE])\n```\n\n## Import\n\n```go\nimport \"github.com/datumbrain/nulltypes\"\n```\n\n## Usage\n\nHere is an example usage with _GORM_.\n\n```go\npackage models\n\ntype User struct {\n\tID              uint                 `json:\"id\" gorm:\"primary_key\"`\n\tName            string               `json:\"name\"`\n\tAddress         nulltypes.NullString `json:\"address,omitempty\"`\n\tCreationDate    time.Time            `json:\"-\" gorm:\"autoCreateTime:milli;default:current_timestamp\"`\n\tUpdationDate    nulltypes.NullTime   `json:\"-\" gorm:\"autoUpdateTime:milli\"` \n\tTerminationDate nulltypes.NullTime   `json:\"termination_date,omitempty\"`\n\tManagerID       nulltypes.NullInt64  `json:\"manager_id,omitempty\" gorm:\"OnUpdate:CASCADE,OnDelete:SET NULL\"`\n}\n```\n\n```go\nuser := User{\n\tID:           0,\n\tName:         \"John Doe\",\n\tAddress:      nulltypes.String(\"221B Baker Street\"),\n\tCreationDate: time.Now(),\n\tUpdationDate: nulltypes.Now(),\n\tManagerID:    nulltypes.Int64(5),\n}\n```\n\n## Author\n\n- [Faizan Khalid](https://github.com/iamfaizankhalid)\n- [Fahad Siddiqui](https://github.com/fahadsiddiqui)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdatumbrain%2Fnulltypes","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdatumbrain%2Fnulltypes","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdatumbrain%2Fnulltypes/lists"}