https://github.com/mackee/nephia-plugin-teng
https://github.com/mackee/nephia-plugin-teng
Last synced: 12 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/mackee/nephia-plugin-teng
- Owner: mackee
- License: other
- Created: 2013-07-08T11:51:58.000Z (almost 13 years ago)
- Default Branch: master
- Last Pushed: 2019-12-04T16:44:21.000Z (over 6 years ago)
- Last Synced: 2025-07-06T13:58:34.435Z (12 months ago)
- Language: Perl
- Size: 187 KB
- Stars: 0
- Watchers: 0
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: Changes
- License: LICENSE
Awesome Lists containing this project
README
[](https://travis-ci.org/mackee/Nephia-Plugin-Teng)
# NAME
Nephia::Plugin::Teng - Simple ORMapper Plugin For Nephia
# SYNOPSIS
use Nephia plugins => [qw/Teng/];
path '/person/:id' => sub {
my $id = path_param('id');
my $row = teng->lookup('person', { id => $id });
return res { 404 } unless $row;
return {
id => $id,
name => $row->get_column('name'),
age => $row->get_column('age'),
};
};
Read row from person table in database in this code.
# DESCRIPTION
## configuration - configuration for Teng.
configuration file:
'DBI' => {
connect_info => ['dbi:SQLite:dbname=data.db'],
teng_plugins => [qw/Lookup Pager/]
},
The "connect\_info" is connect information for [DBI](http://search.cpan.org/perldoc?DBI).
Enumerate in "plugins" option if you want load Teng plugins.
## teng - Create Teng Object
"teng" DSL create the Teng Object.
## database\_do - load SQL before plackup.
In this example to create table before plackup.
in controller :
database_do "CREATE TABLE IF NOT EXISTS person (id INTEGER, name TEXT, age INTEGER);"
path '/' => sub {
...
};
# SEE ALSO
[Nephia](http://search.cpan.org/perldoc?Nephia)
[Teng](http://search.cpan.org/perldoc?Teng)
# LICENSE
Copyright (C) macopy.
This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself.
# AUTHOR
mackee
ichigotake