zorm

package module
v0.0.0-...-fd25ea2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 13, 2023 License: MIT Imports: 4 Imported by: 0

README

Zorm

How to assemble a ORM

Why

talk is cheap, show me the code

  • best way to learn something is through teach others
  • best way to understand something very well is to make one by yourself
How

how many steps will it take to put an elephant into refrigerator

  1. open the link
  2. do the operation
  3. close the link
Practice

https://segmentfault.com/a/1190000021693989

  1. base on this article
  2. assemble sql
  3. use reflect to deal the result

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type OptionFunc

type OptionFunc func(opts *Options)

func WithDatabase

func WithDatabase(Database string) OptionFunc

func WithHost

func WithHost(Host string) OptionFunc

func WithOptions

func WithOptions(options Options) OptionFunc

func WithPass

func WithPass(Pass string) OptionFunc

func WithPort

func WithPort(Port string) OptionFunc

func WithUser

func WithUser(User string) OptionFunc

type Options

type Options struct {
	Host     string
	Port     string
	User     string
	Pass     string
	Database string
}

type Zorm

type Zorm struct {
	Conn  *sql.DB
	Query query.Query
	// contains filtered or unexported fields
}

func NewZorm

func NewZorm(opts ...OptionFunc) *Zorm

func (*Zorm) Close

func (z *Zorm) Close()

关闭连接

func (*Zorm) Connect

func (z *Zorm) Connect() (err error)

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL