Giter Site home page Giter Site logo

wellercs / datamapper Goto Github PK

View Code? Open in Web Editor NEW

This project forked from seancorfield/datamapper

0.0 2.0 0.0 156 KB

A couple of CFCs from the World Singles data mapper to show how we wrap Clojure (vectors of) hashmaps to present a thin OO veneer to our CFML code.

License: GNU General Public License v3.0

ColdFusion 100.00%

datamapper's Introduction

datamapper

A couple of CFCs from the World Singles data mapper to show how we wrap Clojure (vectors of) hashmaps to present a thin OO veneer to our CFML code.

Presented as GPLv3 code so you can't incorporate this into your code unless your code is also open source under GPLv3!

The Service CFC is injected into all of our code as variables.orm. Most of our service CFCs extend the BaseService CFC to provide basic cached get() for entities (I've chopped a lot of other stuff out of this CFC).

The Bean CFC is an Iterating Business Object wrapper around an array of structs which represent rows in the database. Our specific business objects extend this so they can add business logic and override specific get/set operations if needed.

When you do orm.create("foo"), it'll use ws/model/orm/beans/foo.cfc if it exists (which extends Bean) or else it'll fall back to Bean itself. It is assumed the associated table name is "foo".

This also allows us to "attach" an IBO to any data set and treat it as a specific business object. We do this to allow a joined data set to be viewed as both a set of users and as a set of messages for example, when we have joined across those two tables. You can also attach a generic IBO to an arbitrary data set and that provides get/set methods.

The Bean supports foo.getBar() where foo contains barid and thats an FK to bar.id and it will lazy load a "bar" object - many-to-one relationship. Similarly foo.getQuuxIterator() will use quux.fooid to lazy load a one-to-many relationship.

datamapper's People

Contributors

seancorfield avatar

Watchers

 avatar  avatar

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.