| 1 | package Daje::Workflow::Database::Model::WorkflowConnection; | ||
| 2 | use Mojo::Base -base, -signatures; | ||
| 3 | use v5.40; | ||
| 4 | |||
| 5 | # NAME | ||
| 6 | # ==== | ||
| 7 | # | ||
| 8 | # Daje::Workflow::Database::Model::WorkflowConnection | ||
| 9 | # | ||
| 10 | # | ||
| 11 | # REQUIRES | ||
| 12 | # ======== | ||
| 13 | # | ||
| 14 | # Mojo::Base> | ||
| 15 | # | ||
| 16 | # | ||
| 17 | # METHODS | ||
| 18 | # | ||
| 19 | # load($self) | ||
| 20 | # | ||
| 21 | # save(); | ||
| 22 | # | ||
| 23 | # | ||
| 24 | # LICENSE | ||
| 25 | # ======= | ||
| 26 | # | ||
| 27 | # Copyright (C) janeskil1525. | ||
| 28 | # | ||
| 29 | # This library is free software; you can redistribute it and/or modify | ||
| 30 | # it under the same terms as Perl itself. | ||
| 31 | # | ||
| 32 | # AUTHOR | ||
| 33 | # ====== | ||
| 34 | # | ||
| 35 | # janeskil1525 E<lt>janeskil1525@gmail.comE<gt> | ||
| 36 | |||
| 37 | use Data::Dumper; | ||
| 38 | |||
| 39 | has 'db'; | ||
| 40 | |||
| 41 | sub load($self, $data) { | ||
| 42 | |||
| 43 | my $result = $self->db->select( | ||
| 44 | 'workflow_connections', undef, | ||
| 45 | { | ||
| 46 | connector => $data->{connector}, | ||
| 47 | connector_fkey => $data->{connector_pkey}, | ||
| 48 | } | ||
| 49 | ); | ||
| 50 | |||
| 51 | my $hash; | ||
| 52 | $hash = $result->hash if $result->rows > 0; | ||
| 53 | |||
| 54 | return $hash; | ||
| 55 | } | ||
| 56 | |||
| 57 | sub insert($self, $data) { | ||
| 58 | |||
| 59 | my $workflow_connections_pkey = 0; | ||
| 60 | try { | ||
| 61 | delete %$data{workflow_connections_pkey}; | ||
| 62 | $workflow_connections_pkey= $self->db->insert( | ||
| 63 | "workflow_connections", | ||
| 64 | { | ||
| 65 | workflow_fkey => $data->{workflow_fkey}, | ||
| 66 | connector => $data->{connector}, | ||
| 67 | connector_fkey => $data->{connector_fkey}, | ||
| 68 | }, | ||
| 69 | { | ||
| 70 | returning => 'workflow_connections_pkey' | ||
| 71 | } | ||
| 72 | )->hash->{workflow_connections_pkey}; | ||
| 73 | } catch ($e) { | ||
| 74 | my $test = $e; | ||
| 75 | say $e->to_string; | ||
| 76 | $e = $e; | ||
| 77 | }; | ||
| 78 | |||
| 79 | return $workflow_connections_pkey; | ||
| 80 | } | ||
| 81 | 1; | ||
| 82 | |||
| 83 | |||
| 84 | |||
| 85 | |||
| 86 | |||
| 87 | |||
| 88 | #################### pod generated by Pod::Autopod - keep this line to make pod updates possible #################### | ||
| 89 | |||
| 90 | =head1 NAME | ||
| 91 | |||
| 92 | |||
| 93 | Daje::Workflow::Database::Model::WorkflowConnection | ||
| 94 | |||
| 95 | |||
| 96 | |||
| 97 | |||
| 98 | =head1 REQUIRES | ||
| 99 | |||
| 100 | |||
| 101 | Mojo::Base> | ||
| 102 | |||
| 103 | |||
| 104 | METHODS | ||
| 105 | |||
| 106 | load($self) | ||
| 107 | |||
| 108 | save(); | ||
| 109 | |||
| 110 | |||
| 111 | |||
| 112 | |||
| 113 | =head1 METHODS | ||
| 114 | |||
| 115 | =head2 insert($self, | ||
| 116 | |||
| 117 | insert($self,(); | ||
| 118 | |||
| 119 | =head2 load($self, | ||
| 120 | |||
| 121 | load($self,(); | ||
| 122 | |||
| 123 | |||
| 124 | =head1 AUTHOR | ||
| 125 | |||
| 126 | |||
| 127 | janeskil1525 E<lt>janeskil1525@gmail.comE<gt> | ||
| 128 | |||
| 129 | |||
| 130 | =head1 LICENSE | ||
| 131 | |||
| 132 | |||
| 133 | Copyright (C) janeskil1525. | ||
| 134 | |||
| 135 | This library is free software; you can redistribute it and/or modify | ||
| 136 | it under the same terms as Perl itself. | ||
| 137 | |||
| 138 | |||
| 139 | |||
| 140 | =cut | ||
| 141 |