{"id":18437809,"url":"https://github.com/vsrc/lucius","last_synced_at":"2025-04-14T13:14:12.433Z","repository":{"id":80545167,"uuid":"56974416","full_name":"vsrc/lucius","owner":"vsrc","description":"CRUD for mgo - golang mongodb driver","archived":false,"fork":false,"pushed_at":"2016-04-24T15:02:29.000Z","size":14,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-16T10:42:56.160Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vsrc.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":"2016-04-24T13:57:55.000Z","updated_at":"2016-04-24T14:09:25.000Z","dependencies_parsed_at":null,"dependency_job_id":"f0cf6f54-909b-478e-9104-ac36fd9e21dd","html_url":"https://github.com/vsrc/lucius","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/vsrc%2Flucius","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vsrc%2Flucius/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vsrc%2Flucius/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vsrc%2Flucius/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vsrc","download_url":"https://codeload.github.com/vsrc/lucius/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248886331,"owners_count":21177645,"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":[],"created_at":"2024-11-06T06:16:09.960Z","updated_at":"2025-04-14T13:14:12.401Z","avatar_url":"https://github.com/vsrc.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Lucius\nCRUD for mgo - golang mongodb driver\nPackage for quick plug'n play use of mgo - mongodb driver for golang language.\n\nProvides functions for basic manipulation of mongodb documents in CRUD (Create, Read, Update, Delete) pattern.\n\n## Install\n```sh\ngo get github.com/vedrans/lucius.git\n```\n\n## Usage\nBefore using db host and name needs to be setup with public `SetDB` function which accepts two string parameters (db host and name) or same can be done using two separate public functions `SetDBHost` and `SetDBName`.\n\n#### Create\n`Create` function accepts document in `bson.M` format (from `labix.org/v2/mgo/bson` package) and collection name as string parameter. It returns error  if document couldn't be saved for some reason or nil otherwise.\n\n#### FindByID\n`FindByID` function finds one document that is matching given ID and collection name. Function accepts two parameters: ID (in `bson.ObjectId` type) and collection name (in string type) and returns two parameters document in `bson.M` format and error if query failed, nil otherwise.\n\n#### FindBy\n`FindBy` function finds one document that is matching given condition and collection name. This function accepts condition writen in `bson.M` format as first parameter and collection name as second parameter. It returns two parameters: document in `bson.M` format and error if query failed, nil otherwise. \n\n#### FindAll\n`FindAll` function returns all documents in specific collection as an array of `bson.M` objects as first parameter on return. It requests collection name as `string` and returns error as second parameter or nil if query was successful. \n\n#### Update\n`Update` function replaces matched document with provided. It accepts condition as `bson.M`, new document  as `bson.M` and collection name as `string`. It returns error if query failed, nil otherwise.\n\n#### Patch\nAs difference from `Update` function, `Patch` just updates matched document with provided. It accepts condition as `bson.M`, update as `bson.M` and collection name as `string`. It returns error if query failed, nil otherwise. It basically is merging existing document with provided update. If some parameter exists in both documents update one is replacing existing one, if existing document doesn't have parameter update document have  it will be simply added.\n\n#### Delete\n`Delete` function deletes matched document from collection. It accepts id of document in `bson.ObjectId` format and collection name as `string` and returns error if query fails otherwise nil.\n\n## Licence\nThis package is covered by GNU GENERAL PUBLIC LICENSE Version 3 licence.\n\n## Contributing\nIf you would like to improve this package all pull requests are very welcome as long as covered by test.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvsrc%2Flucius","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvsrc%2Flucius","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvsrc%2Flucius/lists"}