Categorygithub.com/stevenzack/px
modulepackage
1.3.0
Repository: https://github.com/stevenzack/px.git
Documentation: pkg.go.dev

# README

PGX

Simple PostgreSQL ORM extension for Golang

Install

go get -u github.com/stevenzack/px

Example

package main

import (
	"database/sql"
	"fmt"
	"log"
	"time"

	"github.com/stevenzack/px"
)

type User struct {
	Id          uint32                                               // serial not null primary key
	PhoneNumber sql.NullString    `limit:"36" index:"unique"` // varchar(36) unique index
	Info        map[string]string                                  // jsonb
	UpdateTime  time.Time         `index:""`
	CreateTime  time.Time         
}

func init() {
	log.SetFlags(log.Lshortfile)
}

func main() {

	urlExample := "postgres://stevenzack:@localhost:5432/langenius"
	c, e := px.NewBaseModel(urlExample, User{})
	if e != nil {
		log.Println(e)
		return
	}
	id, e := c.Insert(User{
		PhoneNumber: sql.NullString{Valid: true, String: "asd"},
	})
	if e != nil {
		log.Println(e)
		return
	}
	fmt.Println("inserted: ", id)

	v, e := c.Find(id)
	if e != nil {
		log.Println(e)
		return
	}
	fmt.Println(v)
}

# Functions

No description provided by the author
No description provided by the author
select column_name,data_type from information_schema.columns where table_catalog='langenius' and table_schema='public' and table_name='student'.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Variables

No description provided by the author
No description provided by the author

# Structs

No description provided by the author
No description provided by the author
No description provided by the author