Git Product home page Git Product logo

gizmo's Introduction

Gizmo

Gizmo is a library that allows for the creation of versioned, view-aware objects written in a relational style. It is a simple, safe, and productive framework for creating content that will be present data different in different situations and is automatically versioned on every change.

Getting Started

  1. Download and install it:

    $ go get github.com/FoxComm/gizmo
  2. Run the database migrations:

    $ gizmo setup
  3. Import gizmo to your code:

    import "github.com/FoxComm/gizmo"
  4. Add gizmo.EntityObject to the struct you want to save:

    type Product struct {
      gizmo.EntityObject
    
      Title       string
      Description string
    }
  5. Create Manager and connect to your database:

    dbHost := "127.0.0.1"
    dbName := "gizmo"
    dbUser := "gizmo"
    dbPassword := "I<3Gizmo"
    
    mgr, err := gizmo.NewManager(dbHost, dbName, dbUser, dbPassword)
  6. Save a struct implementing EntityObject using Manager:

    p := Product{
      Title:       "Some product",
      Description: "A product for demo purposes",
    }
    
    viewID := 1
    saved, err := mgr.Create(p, viewID)
  7. Retrieve the struct based on it's ID and view ID:

    id := 1
    viewID := 1
    
    product := Product{}
    err := mgr.FindByID(id, viewID, &product)

gizmo's People

Contributors

jmataya avatar adilwali avatar pavel-main avatar

Watchers

 avatar James Cloos avatar  avatar

Forkers

jmataya

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.