Giter VIP home page Giter VIP logo

ornn's Introduction

ornn: Object Relation No Need

Ornn is a tool that generates database-using code from schema and sql

built in atlas ( https://github.com/ariga/atlas )

  1. built your db schema

  2. run ornn

  3. code generated, all done!

  4. If additional queries are required, add in the config.

오른이 되세요

Quick Start

package main

import (
	"fmt"
	"os"

	"github.com/gokch/ornn/cli"
)

func main() {
	if err := cli.Run(os.Args[1:]); err != nil {
		fmt.Errorf("error : %v", err)
		os.Exit(1)
	}
}

Build

go get github.com/gokch/ornn
cd $GOPATH/src/github.com/gokch/ornn
go build .

Run

Usage:
  ornn [flags]

Flags:
  -A, --db_addr string            database server address (default "127.0.0.1")
  -i, --db_id string              database server id
  -n, --db_name string            database name
      --db_path string            path for save db files. sqlite only (default "./output/sqlite-database.db")
  -P, --db_port string            database server port (default "3306")
  -p, --db_pw string              database server password
  -D, --db_type string            database type ( mysql, mariadb, postgres, sqlite, tidb, cockroachdb ) (default "mysql")
      --file_config_load bool     load config from existing file ( default false )
      --file_config_path string   config json file path (default "./output/config.json")
      --file_gen_path string      generate golang file path (default "./output/gen.go")
      --file_schema_load bool     load schema from existing file and migrate database ( default false )
      --file_schema_path string   schema hcl file path (default "./output/schema.hcl")
      --gen_class_name string     class name (default "Gen")
      --gen_do_not_edit string    do not edit comment (default "// Code generated - DO NOT EDIT.\n// This file is a generated and any changes will be lost.\n")
      --gen_package_name string   package name (default "gen")
  -h, --help                      help for ornn

Example

./ornn -D mysql -A 127.0.0.1 -P 3306 -i root -p 1234 -n db_name

ornn's People

Contributors

rabbitprincess avatar

Stargazers

Javed Khan avatar JunYong avatar 무무 avatar Juunini avatar Jeong Hyunseok  avatar 최민규 avatar DanielKim avatar  avatar  avatar Roman avatar JaeSang Yoo avatar snowmerak avatar

Watchers

 avatar

ornn's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.