{"id":18007685,"url":"https://github.com/jagrosh/easysql","last_synced_at":"2025-03-26T12:31:47.303Z","repository":{"id":26015392,"uuid":"107104748","full_name":"jagrosh/EasySQL","owner":"jagrosh","description":"Manage SQL Tables in H2 with less code and no annotations","archived":false,"fork":false,"pushed_at":"2023-07-07T21:54:48.000Z","size":19,"stargazers_count":20,"open_issues_count":1,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-21T19:01:37.912Z","etag":null,"topics":["h2-database","sql"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jagrosh.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-10-16T09:12:27.000Z","updated_at":"2024-10-31T23:02:30.000Z","dependencies_parsed_at":"2024-10-30T01:37:59.375Z","dependency_job_id":null,"html_url":"https://github.com/jagrosh/EasySQL","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jagrosh%2FEasySQL","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jagrosh%2FEasySQL/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jagrosh%2FEasySQL/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jagrosh%2FEasySQL/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jagrosh","download_url":"https://codeload.github.com/jagrosh/EasySQL/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245654187,"owners_count":20650820,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["h2-database","sql"],"created_at":"2024-10-30T01:14:12.240Z","updated_at":"2025-03-26T12:31:47.297Z","avatar_url":"https://github.com/jagrosh.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# EasySQL\nManage SQL Tables in H2 with less code\n\n```java\nimport com.jagrosh.easysql.*;\nimport com.jagrosh.easysql.columns.*;\nimport java.time.Instant;\n\npublic class LastSeenManager extends DataManager {\n    \n    public final static SQLColumn\u003cLong\u003e USER_ID = new LongColumn(\"USER_ID\", false, 0, true);\n    public final static SQLColumn\u003cInstant\u003e LAST_ACTIVE = new InstantColumn(\"LAST_ACTIVE\", false, Instant.ofEpochSecond(0L));\n    \n    public LastSeenManager(DatabaseConnector connector) {\n        super(connector, \"LAST_SEEN\");\n    }\n    \n    public synchronized void setActive(long userId) {\n        readWrite(selectAll(USER_ID.is(userId)), results -\u003e {\n            if(results.next()) {\n                LAST_ACTIVE.updateValue(results, Instant.now());\n                results.updateRow();\n            } else {\n                results.moveToInsertRow();\n                USER_ID.updateValue(results, userId);\n                LAST_ACTIVE.updateValue(results, Instant.now());\n                results.insertRow();\n            }\n        });\n    }\n    \n    public synchronized Instant lastActive(User user) {\n        return read(select(USER_ID.is(user.getId()), LAST_ACTIVE), results -\u003e {\n            if(results.next())\n                return LAST_ACTIVE.getValue(results);\n            return null;\n        });\n    }\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjagrosh%2Feasysql","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjagrosh%2Feasysql","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjagrosh%2Feasysql/lists"}