frud

command module
v0.0.0-...-e37af68 Latest Latest
Warning

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

Go to latest
Published: May 6, 2018 License: MIT Imports: 14 Imported by: 0

README

Frud - Framework for CRUD (Create, Read, Update, Delete) applications

In my attempt to learn Go I wanted to create a pluggable framework where the only work required by the user is to create a plugin like object and pass this to the server. Another option is to create their data models from a configuration object in JSON and pass this to the server, it will then create these models use the attached database drivers

Database's currently supported (in limited capacity):

  • Neo4J
  • MongoDB

This is by no means finished in any capacity, but will gladly accept pull requests.

Getting Started

First thing is to compile the project

go build
Plugin Definition Method

Next thing to do is to compile your plugins, you can find an example plugin within the _plugins directory. The reason for the underscore is that the go compiler will ignore directorys within the plugin. You have to make sure to follow the rules dictated by the go plugin library. Make sure in the configuration object to set the pathtocompiled, and the pathtocode. The server does need both (look to the file "config.json" for an example config").

Model Definition Method

To use the model method you are going to have to define it within the config.

"plugins": [
      {
        "name": "model", //Required and unique
        "path": "/modelonly", //Required and unique
        "description": "Model only endpoint",
        "model": [
          {
            "key": "name", //Required and unique,
            "value_type": "string", // Required - values can be int, string,
            "options": ["id"] // Not required - must exist at most one model field with "id" option within the top layer of fields. Meaning ID cannot be within a nested field.  Although future option will be to allow a whole nested field to be an id.
          }
          {
            "key": "anotherExample", //Required and unique,
            "value_type": "int" //Required - values can be int, string,
            "options" : ["empty"] // Empty option allows for this field to be empty in a request - default is nonempty.
          }
          {
            "key": "deepValue", 
            "value_type" : [ // Can create nested types.
              {
                "key": "subfield_0", // Must be unique up to the nested field.
                "value_type": "another" // Can use user defined types
              },
              {
                "key": "subfield_1",
                "value_type": "string"
              }
            ]
          }
        ]
      },
      {
        "name": "another", //Required and unique
        "path": "/another", //Required and unique
        "description": "Model only endpoint",
        "model": [
          {
            "key": "name", //Required and unique,
            "value_type": "string", // Required - values can be int, string,
            "options": ["id"] // Not required - must exist at most one model field with "id" option
          }
        ]
      }
    ]

Authors

  • Kenneth R Hancock

License

This project is licensed under the MIT License - see the LICENSE.md file for details

Documentation

Overview

Package frud

Directories

Path Synopsis
_plugins
Package config is the package that holds all the configurable structures and functions.
Package config is the package that holds all the configurable structures and functions.
Package database will hold all the drivers and the CreateDatabase method.
Package database will hold all the drivers and the CreateDatabase method.
neo
Package neo holds all the logic around instantiating a Driver interface around the Neo4J database architecture
Package neo holds all the logic around instantiating a Driver interface around the Neo4J database architecture
Package errors holds the error objects used by the Frud framework
Package errors holds the error objects used by the Frud framework
Package middleware will hold the middleware objects used by the frud framework.
Package middleware will hold the middleware objects used by the frud framework.
Package plug encapsulates the plugin style that this framework uses.
Package plug encapsulates the plugin style that this framework uses.

Jump to

Keyboard shortcuts

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