hive_sql 1.0.0.pre.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (68) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +58 -0
  3. data/Gemfile +4 -0
  4. data/LICENSE +41 -0
  5. data/Rakefile +538 -0
  6. data/bin/hive_sql +23 -0
  7. data/hive_sql.gemspec +41 -0
  8. data/lib/hive_sql.rb +101 -0
  9. data/lib/hive_sql/models/account.rb +119 -0
  10. data/lib/hive_sql/models/block.rb +18 -0
  11. data/lib/hive_sql/models/comment.rb +142 -0
  12. data/lib/hive_sql/models/community.rb +78 -0
  13. data/lib/hive_sql/models/community_role.rb +37 -0
  14. data/lib/hive_sql/models/community_subscriber.rb +23 -0
  15. data/lib/hive_sql/models/connection.rb +18 -0
  16. data/lib/hive_sql/models/dynamic_global_properties.rb +45 -0
  17. data/lib/hive_sql/models/follower.rb +17 -0
  18. data/lib/hive_sql/models/reblog.rb +20 -0
  19. data/lib/hive_sql/models/sql_base.rb +28 -0
  20. data/lib/hive_sql/models/tag.rb +15 -0
  21. data/lib/hive_sql/models/token.rb +27 -0
  22. data/lib/hive_sql/models/transaction.rb +76 -0
  23. data/lib/hive_sql/models/tx/account_create.rb +26 -0
  24. data/lib/hive_sql/models/tx/account_recover.rb +20 -0
  25. data/lib/hive_sql/models/tx/account_update.rb +22 -0
  26. data/lib/hive_sql/models/tx/account_witness_proxy.rb +31 -0
  27. data/lib/hive_sql/models/tx/account_witness_vote.rb +22 -0
  28. data/lib/hive_sql/models/tx/claim_reward_balance.rb +21 -0
  29. data/lib/hive_sql/models/tx/comment.rb +24 -0
  30. data/lib/hive_sql/models/tx/comments_option.rb +23 -0
  31. data/lib/hive_sql/models/tx/convert.rb +20 -0
  32. data/lib/hive_sql/models/tx/custom.rb +25 -0
  33. data/lib/hive_sql/models/tx/custom/community.rb +32 -0
  34. data/lib/hive_sql/models/tx/custom/follow.rb +48 -0
  35. data/lib/hive_sql/models/tx/custom/reblog.rb +22 -0
  36. data/lib/hive_sql/models/tx/custom/witness.rb +11 -0
  37. data/lib/hive_sql/models/tx/delegate_vesting_share.rb +20 -0
  38. data/lib/hive_sql/models/tx/delete_comment.rb +19 -0
  39. data/lib/hive_sql/models/tx/escrow_approve.rb +23 -0
  40. data/lib/hive_sql/models/tx/escrow_dispute.rb +22 -0
  41. data/lib/hive_sql/models/tx/escrow_release.rb +25 -0
  42. data/lib/hive_sql/models/tx/escrow_transfer.rb +28 -0
  43. data/lib/hive_sql/models/tx/feed.rb +20 -0
  44. data/lib/hive_sql/models/tx/limit_order.rb +26 -0
  45. data/lib/hive_sql/models/tx/pow.rb +19 -0
  46. data/lib/hive_sql/models/tx/transfer.rb +24 -0
  47. data/lib/hive_sql/models/tx/update_proposal_vote.rb +31 -0
  48. data/lib/hive_sql/models/tx/vote.rb +21 -0
  49. data/lib/hive_sql/models/tx/withdraw.rb +19 -0
  50. data/lib/hive_sql/models/tx/withdraw_vesting_route.rb +21 -0
  51. data/lib/hive_sql/models/tx/witness_update.rb +24 -0
  52. data/lib/hive_sql/models/vo/author_reward.rb +22 -0
  53. data/lib/hive_sql/models/vo/comment_benefactor_reward.rb +23 -0
  54. data/lib/hive_sql/models/vo/curation_reward.rb +21 -0
  55. data/lib/hive_sql/models/vo/fill_convert_request.rb +21 -0
  56. data/lib/hive_sql/models/vo/fill_order.rb +23 -0
  57. data/lib/hive_sql/models/vo/fill_transfer_from_savings.rb +23 -0
  58. data/lib/hive_sql/models/vo/fill_vesting_withdraw.rb +21 -0
  59. data/lib/hive_sql/models/vo/interest.rb +19 -0
  60. data/lib/hive_sql/models/vo/liquidity_reward.rb +19 -0
  61. data/lib/hive_sql/models/vo/producer_reward.rb +19 -0
  62. data/lib/hive_sql/models/vo/proposal_pay.rb +20 -0
  63. data/lib/hive_sql/models/vo/return_vesting_delegation.rb +20 -0
  64. data/lib/hive_sql/models/vo/shutdown_witness.rb +18 -0
  65. data/lib/hive_sql/models/vo/sps_fund.rb +18 -0
  66. data/lib/hive_sql/models/witness.rb +48 -0
  67. data/lib/hive_sql/version.rb +3 -0
  68. metadata +413 -0
@@ -0,0 +1,20 @@
1
+ module HiveSQL
2
+ module Tx
3
+ class Feed < HiveSQL::SqlBase
4
+
5
+ self.table_name = :TxFeeds
6
+
7
+ end
8
+ end
9
+ end
10
+
11
+ # Structure
12
+ #
13
+ # HiveSQL::Tx::Feed(
14
+ # ID: integer,
15
+ # tx_id: integer,
16
+ # publisher: varchar,
17
+ # exchange_rate_base: money,
18
+ # exchange_rate_quote: money,
19
+ # timestamp: datetime
20
+ # )
@@ -0,0 +1,26 @@
1
+ module HiveSQL
2
+ module Tx
3
+ class LimitOrder < HiveSQL::SqlBase
4
+
5
+ self.table_name = :TxLimitOrders
6
+
7
+ end
8
+ end
9
+ end
10
+
11
+ # Structure
12
+ #
13
+ # HiveSQL::Tx::LimitOrder(
14
+ # ID: integer,
15
+ # tx_id: integer,
16
+ # owner: varchar,
17
+ # orderid: integer,
18
+ # cancel: boolean,
19
+ # amount_to_sell: money,
20
+ # min_to_receive: money,
21
+ # exchange_rate_base: money,
22
+ # exchange_rate_quote: money,
23
+ # fill_or_kill: boolean,
24
+ # expiration: datetime,
25
+ # timestamp: datetime
26
+ # )
@@ -0,0 +1,19 @@
1
+ module HiveSQL
2
+ module Tx
3
+ class Pow < HiveSQL::SqlBase
4
+
5
+ self.table_name = :TxPows
6
+
7
+ end
8
+ end
9
+ end
10
+
11
+ # Structure
12
+ #
13
+ # HiveSQL::Tx::Pow(
14
+ # ID: integer,
15
+ # tx_id: integer,
16
+ # worker_account: varchar,
17
+ # block_id: varchar,
18
+ # timestamp: datetime
19
+ # )
@@ -0,0 +1,24 @@
1
+ module HiveSQL
2
+ module Tx
3
+ class Transfer < HiveSQL::SqlBase
4
+
5
+ self.table_name = :TxTransfers
6
+
7
+ end
8
+ end
9
+ end
10
+
11
+ # Structure
12
+ #
13
+ # HiveSQL::Tx::Transfer(
14
+ # ID: integer,
15
+ # tx_id: integer,
16
+ # type: varchar,
17
+ # from: varchar,
18
+ # to: varchar,
19
+ # amount: money,
20
+ # amount_symbol: varchar,
21
+ # memo: text,
22
+ # request_id: integer,
23
+ # timestamp: datetime
24
+ # )
@@ -0,0 +1,31 @@
1
+ module HiveSQL
2
+ module Tx
3
+ class UpdateProposalVote < HiveSQL::SqlBase
4
+ belongs_to :voter_record, foreign_key: :account, primary_key: :voter, class_name: 'HiveSQL::Account'
5
+
6
+ self.table_name = :TxUpdateProposalVotes
7
+
8
+ scope :proposal, lambda { |id, invert = false|
9
+ if !!invert
10
+ where("? NOT IN (SELECT value FROM OPENJSON(proposal_ids,'$'))", id)
11
+ else
12
+ where("? IN (SELECT value FROM OPENJSON(proposal_ids,'$'))", id)
13
+ end
14
+ }
15
+
16
+ scope :approve, lambda {|approve = true| where(approve: approve)}
17
+ end
18
+ end
19
+ end
20
+
21
+ # Structure
22
+ #
23
+ # HiveSQL::Tx::Vote(
24
+ # ID: integer,
25
+ # tx_id: integer,
26
+ # voter: varchar,
27
+ # proposal_ids: varchar,
28
+ # approve: boolean,
29
+ # extensions: varchar,
30
+ # timestamp: datetime
31
+ # )
@@ -0,0 +1,21 @@
1
+ module HiveSQL
2
+ module Tx
3
+ class Vote < HiveSQL::SqlBase
4
+
5
+ self.table_name = :TxVotes
6
+
7
+ end
8
+ end
9
+ end
10
+
11
+ # Structure
12
+ #
13
+ # HiveSQL::Tx::Vote(
14
+ # ID: integer,
15
+ # tx_id: integer,
16
+ # voter: varchar,
17
+ # author: varchar,
18
+ # permlink: varchar,
19
+ # weight: integer,
20
+ # timestamp: datetime
21
+ # )
@@ -0,0 +1,19 @@
1
+ module HiveSQL
2
+ module Tx
3
+ class Withdraw < HiveSQL::SqlBase
4
+
5
+ self.table_name = :TxWithdraws
6
+
7
+ end
8
+ end
9
+ end
10
+
11
+ # Structure
12
+ #
13
+ # HiveSQL::Tx::Withdraw(
14
+ # ID: integer,
15
+ # tx_id: integer,
16
+ # account: varchar,
17
+ # vesting_shares: money,
18
+ # timestamp: datetime
19
+ # )
@@ -0,0 +1,21 @@
1
+ module HiveSQL
2
+ module Tx
3
+ class WithdrawVestingRoute < HiveSQL::SqlBase
4
+
5
+ self.table_name = :TxWithdrawVestingRoutes
6
+
7
+ end
8
+ end
9
+ end
10
+
11
+ # Structure
12
+ #
13
+ # HiveSQL::Tx::WithdrawVestingRoute(
14
+ # ID: integer,
15
+ # tx_id: integer,
16
+ # from_account: varchar,
17
+ # to_account: varchar,
18
+ # percent: integer,
19
+ # auto_vest: boolean,
20
+ # timestamp: datetime
21
+ # )
@@ -0,0 +1,24 @@
1
+ module HiveSQL
2
+ module Tx
3
+ class WitnessUpdate < HiveSQL::SqlBase
4
+
5
+ self.table_name = :TxWitnessUpdates
6
+
7
+ end
8
+ end
9
+ end
10
+
11
+ # Structure
12
+ #
13
+ # HiveSQL::Tx::WitnessUpdate(
14
+ # ID: integer,
15
+ # tx_id: integer,
16
+ # owner: varchar,
17
+ # url: varchar_max,
18
+ # block_signing_key: varchar,
19
+ # props_account_creation_fee: money,
20
+ # props_maximum_block_size: integer,
21
+ # props_sbd_interest_rate: integer,
22
+ # fee: money,
23
+ # timestamp: datetime
24
+ # )
@@ -0,0 +1,22 @@
1
+ module HiveSQL
2
+ module Vo
3
+ class AuthorReward < HiveSQL::SqlBase
4
+
5
+ self.table_name = :VOAuthorRewards
6
+
7
+ end
8
+ end
9
+ end
10
+
11
+ # Structure
12
+ #
13
+ # HiveSQL::Vo::AuthorReward(
14
+ # ID: integer,
15
+ # block_num: integer,
16
+ # timestamp: datetime,
17
+ # author: varchar,
18
+ # permlink: varchar,
19
+ # sbd_payout: money,
20
+ # steem_payout: money,
21
+ # vesting_payout: money
22
+ # )
@@ -0,0 +1,23 @@
1
+ module HiveSQL
2
+ module Vo
3
+ class CommentBenefactorReward < HiveSQL::SqlBase
4
+
5
+ self.table_name = :VOCommentBenefactorRewards
6
+
7
+ end
8
+ end
9
+ end
10
+
11
+ # Structure
12
+ #
13
+ # HiveSQL::Vo::CurationReward(
14
+ # ID: integer,
15
+ # block_num: integer,
16
+ # timestamp: datetime,
17
+ # benefactor: varchar,
18
+ # author: varchar,
19
+ # permlink: varchar,
20
+ # sbd_payout: money
21
+ # steem_payout: money
22
+ # vesting_payout: decimal(18,6)
23
+ # )
@@ -0,0 +1,21 @@
1
+ module HiveSQL
2
+ module Vo
3
+ class CurationReward < HiveSQL::SqlBase
4
+
5
+ self.table_name = :VOCurationRewards
6
+
7
+ end
8
+ end
9
+ end
10
+
11
+ # Structure
12
+ #
13
+ # HiveSQL::Vo::CurationReward(
14
+ # ID: integer,
15
+ # block_num: integer,
16
+ # timestamp: datetime,
17
+ # curator: varchar,
18
+ # author: varchar,
19
+ # permlink: varchar,
20
+ # reward: varchar
21
+ # )
@@ -0,0 +1,21 @@
1
+ module HiveSQL
2
+ module Vo
3
+ class FillConvertRequest < HiveSQL::SqlBase
4
+
5
+ self.table_name = :VOFillConvertRequests
6
+
7
+ end
8
+ end
9
+ end
10
+
11
+ # Structure
12
+ #
13
+ # HiveSQL::Vo::FillConvertRequest(
14
+ # ID: integer,
15
+ # block_num: integer,
16
+ # timestamp: datetime,
17
+ # owner: varchar,
18
+ # requestid: integer,
19
+ # amount_in: varchar,
20
+ # amount_out: varchar
21
+ # )
@@ -0,0 +1,23 @@
1
+ module HiveSQL
2
+ module Vo
3
+ class FillOrder < HiveSQL::SqlBase
4
+
5
+ self.table_name = :VOFillOrders
6
+
7
+ end
8
+ end
9
+ end
10
+
11
+ # Structure
12
+ #
13
+ # HiveSQL::Vo::FillOrder(
14
+ # ID: integer,
15
+ # block_num: integer,
16
+ # timestamp: datetime,
17
+ # current_owner: varchar,
18
+ # current_orderid: integer,
19
+ # current_pays: varchar,
20
+ # open_owner: varchar,
21
+ # open_orderid: integer,
22
+ # open_pays: varchar
23
+ # )
@@ -0,0 +1,23 @@
1
+ module HiveSQL
2
+ module Vo
3
+ class FillTransferFromSavings < HiveSQL::SqlBase
4
+
5
+ self.table_name = :VOFillTransferFromSavings
6
+
7
+ end
8
+ end
9
+ end
10
+
11
+ # Structure
12
+ #
13
+ # HiveSQL::Vo::FillTransferFromSavings(
14
+ # ID: integer,
15
+ # block_num: integer,
16
+ # timestamp: datetime,
17
+ # from: varchar,
18
+ # to: varchar,
19
+ # amount: money,
20
+ # amount_symbol,
21
+ # requestid: bigint,
22
+ # memo: text
23
+ # )
@@ -0,0 +1,21 @@
1
+ module HiveSQL
2
+ module Vo
3
+ class FillVestingWithdraw < HiveSQL::SqlBase
4
+
5
+ self.table_name = :VOFillVestingWithdraws
6
+
7
+ end
8
+ end
9
+ end
10
+
11
+ # Structure
12
+ #
13
+ # HiveSQL::Vo::FillVestingWithdraw(
14
+ # ID: integer,
15
+ # block_num: integer,
16
+ # timestamp: datetime,
17
+ # from_account: varchar,
18
+ # to_account: varchar,
19
+ # withdrawn: varchar,
20
+ # deposited: varchar
21
+ # )
@@ -0,0 +1,19 @@
1
+ module HiveSQL
2
+ module Vo
3
+ class Interest < HiveSQL::SqlBase
4
+
5
+ self.table_name = :VOInterests
6
+
7
+ end
8
+ end
9
+ end
10
+
11
+ # Structure
12
+ #
13
+ # HiveSQL::Vo::Interest(
14
+ # ID: integer,
15
+ # block_num: integer,
16
+ # timestamp: datetime,
17
+ # owner: varchar,
18
+ # Interest: money
19
+ # )
@@ -0,0 +1,19 @@
1
+ module HiveSQL
2
+ module Vo
3
+ class LiquidityReward < HiveSQL::SqlBase
4
+
5
+ self.table_name = :VOLiquidityRewards
6
+
7
+ end
8
+ end
9
+ end
10
+
11
+ # Structure
12
+ #
13
+ # HiveSQL::Vo::LiquidityReward(
14
+ # ID: integer,
15
+ # block_num: integer,
16
+ # timestamp: datetime,
17
+ # owner: varchar,
18
+ # payout: money
19
+ # )
@@ -0,0 +1,19 @@
1
+ module HiveSQL
2
+ module Vo
3
+ class ProducerReward < HiveSQL::SqlBase
4
+
5
+ self.table_name = :VOProducerRewards
6
+
7
+ end
8
+ end
9
+ end
10
+
11
+ # Structure
12
+ #
13
+ # HiveSQL::Vo::ProducerReward(
14
+ # ID: integer,
15
+ # block_num: integer,
16
+ # timestamp: datetime,
17
+ # producer: varchar,
18
+ # vesting_shares: money
19
+ # )