NAME
Mojo::Hakkefuin::Backend::sqlite - SQLite Backend.
SYNOPSIS
use Mojo::Hakkefuin::Backend::sqlite;
my $sqlite = Mojo::Hakkefuin:Backend:sqlite->new(
dir => 'path/your/dir/migrations'
);
DESCRIPTION
Mojo::Hakkefuin::Backend::sqlite is a backend for Mojolicious::Plugin::Hakkefuin based on Mojo::Hakkefuin::Backend. All necessary tables will be created automatically.
ATTRIBUTES
Mojo::Hakkefuin::Backend::sqlite inherits all attributes from Mojo::Hakkefuin::Backend and implements the following new ones.
dir
# Example use as a config
my $backend = Mojo::Hakkefuin::Backend::sqlite->new(
...
dir => '/path/of/dir/location/file/database/',
...
);
# use as a method
my $backend = $backend->dir;
$backend->dir('/path/of/dir/location/file/database/');
This attribute for specify path (directory address) of directory SQLite database file or migrations configuration file.
METHODS
Mojo::Hakkefuin::Backend::sqlite inherits all methods from Mojo::Hakkefuin::Backend and implements the following new ones. In this module contains 2 section methods that is Table Interaction and Data Interaction.
Table Interaction
A section for all activities related to interaction data in a database table.
table_query
my $table_query = $backend->table_query;
$backend->table_query;
This method used by the create_table method to generate a query that will be used to create a database table.
check_table
$backend->check_table();
my $check_table = $backend->check_table;
This method is used to check whether a table in the DBMS exists or not
create_table
$backend->create_table();
my $create_table = $backend->create_table;
This method is used to create database table.
empty_table
$backend->empty_table;
my $empty_table = $backend->empty_table;
This method is used to delete all database table (It means to delete all data in a table).
drop_table
$backend->drop_table;
my $drop_table = $backend->drop_table;
This method is used to drop database table (It means to delete all data in a table and its contents).
Data Interaction
A section for all activities related to data interaction in a database table. These options are currently available:
- $id
-
A variable containing a unique id that is generated when inserting data into a table.
- $identify
-
The variables that contain important information for data login but not crucial information.
-
The variable that contains the cookie hash, which hash is used in the HTTP header.
- $csrf
-
The variable that contains the csrf token hash, which hash is used in the HTTP header.
- $expires
-
The variable that contains timestamp format. e.g.
2023-03-23 12:01:53. For more information see Mojo::Hakkefuin::Utils.
create($identify, $cookie, $csrf, $expires)
$backend->create($identify, $cookie, $csrf, $expires)
Method for insert data login.
read($identify, $cookie)
$backend->read($identify, $cookie);
Method for read data login.
update()
$backend->update($id, $cookie, $csrf);
Method for update data login.
update_csrf()
$backend->update_csrf($id, $csrf);
Method for update CSRF token login.
update_cookie()
$backend->update_cookie($id, $cookie);
Method for update cookie login.
upd_coolock()
$backend->upd_coolock();
Method for update cookie lock session.
upd_lckstate()
$backend->upd_lckstate();
Method for update lock state condition.
delete($identify, $cookie)
$backend->delete($identify, $cookie);
Method for delete data login.
check($identify, $cookie)
$backend->check($identify, $cookie);
Method for check data login.
new()
use Mojo::Hakkefuin::Backend::sqlite;
my $backend = Mojo::Hakkefuin::Backend::sqlite->new(
dir => 'path/your/dir/file/database'
);
Construct a new Mojo::Hakkefuin::Backend::sqlite object.