{"id":44544858,"url":"https://github.com/cheikhshift/db","last_synced_at":"2026-02-13T19:12:07.922Z","repository":{"id":57491806,"uuid":"99850632","full_name":"cheikhshift/db","owner":"cheikhshift","description":"The package aims to match Express seamless integration with NodeJs and MongoDb.","archived":false,"fork":false,"pushed_at":"2018-06-01T10:22:07.000Z","size":145,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-05T22:39:58.469Z","etag":null,"topics":["database-management","go","mongodb","mongoose"],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cheikhshift.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}},"created_at":"2017-08-09T20:35:07.000Z","updated_at":"2018-06-01T10:22:08.000Z","dependencies_parsed_at":"2022-08-31T01:51:11.519Z","dependency_job_id":null,"html_url":"https://github.com/cheikhshift/db","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/cheikhshift/db","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cheikhshift%2Fdb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cheikhshift%2Fdb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cheikhshift%2Fdb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cheikhshift%2Fdb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cheikhshift","download_url":"https://codeload.github.com/cheikhshift/db/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cheikhshift%2Fdb/sbom","scorecard":{"id":275550,"data":{"date":"2025-08-11","repo":{"name":"github.com/cheikhshift/db","commit":"7f5fc942a9dccff7b5c4af0be1518f1211223def"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Code-Review","score":0,"reason":"Found 0/24 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: BSD 3-Clause \"New\" or \"Revised\" License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 2 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-17T14:18:27.343Z","repository_id":57491806,"created_at":"2025-08-17T14:18:27.343Z","updated_at":"2025-08-17T14:18:27.343Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29414595,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-13T06:24:03.484Z","status":"ssl_error","status_checked_at":"2026-02-13T06:23:12.830Z","response_time":78,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["database-management","go","mongodb","mongoose"],"created_at":"2026-02-13T19:12:07.323Z","updated_at":"2026-02-13T19:12:07.916Z","avatar_url":"https://github.com/cheikhshift.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Go-Express\n\n\nMongo DBMS client. The package aims to match Express seamless integration with NodeJs and MongoDb.\n\n[Index](#index)\n\n## Requirements\n\n - MongoDb (access to a server)\n - [Mgo](https://godoc.org/labix.org/v2/mgo#Query) \n\n\t\n#### Dependencies\n(GoDeps supported as well.)\nManually:\n\n\t\tgo get github.com/asaskevich/govalidator\n\t\tgo get gopkg.in/mgo.v2\n\n#### install\n\t\n\tgo get github.com/cheikhshift/db\n\n\n## Import\n\n\timport (\n\t\t\"log\" //optional\n\t\t\"github.com/cheikhshift/db\"\n\t)\n\n## Connect\n\nThe snippet below will connect to your `database` @ your `localhost`\n\n\tdbs,err := db.Connect(\"localhost\",\"database\") \n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\nFormat of server URI : \n\n\t[mongodb://][user:pass@]host1[:port1][,host2[:port2],...][/database][?options]\n\n## Info\nThrouughout this page the statement `model to set query` is used. It refers to the interface you wish to query. This works by using the specified interface as a table/collection name.\n\n## Add new model\n\nDefine a new interface as usual (fields Created and Id are system generated) :\n\n\ttype MyObject struct {\n\t\tId bson.ObjectId `bson:\"_id,omitempty\"`\n\t\tTestField string `valid:\"unique\"`\n\t\tFieldTwo string `valid:\"email,required\"`\n\t\tCreated time.Time //timestamp local format\n\t}\n\nThe following tag will ensure no duplicates happen while saving. \n\n\tTestField string `valid:\"unique\"`\n\nThe following tag `valid` will ensure your field data is an email.\n\n\t FieldTwo string `valid:\"email,required\"`\n\n### Validation\nValidation possible by package [Go Validator](https://github.com/asaskevich/govalidator). Visit the repository for a full list of supported validator interface tags.\n\n## Save a model\n\t\n\tobj := NewObject{FieldTwo: \"value\" }\n\tdbs.New(\u0026obj)\t\n\terr = dbs.Save(\u0026obj)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n## Retrieve model\n\nThe following query will return one object. Within the Find function you may use all of the usual Mongo DB query functions. Remember to add strings even around `$` prefixed parameters. The following example will retrieve one result. Any interface field is converted to lower case on database save, when performing a query type interface field names without capital letters. \n\n\tquery := MyObject{}\n\tdbs.Q(query).Find(db.O{\"fieldtwo\":\"value\"}).One(\u0026query)\n\n\tfmt.Println(query)\n\n## Delete model\nThis function will fail if your interface's `Id` field is blank.\n\n\tobj := NewObject{FieldTwo: \"value\" }\n\terr := dbs.Add(\u0026obj)\t\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\t\n\t\n\tdbs.Remove(\u0026obj)\n\n\n#Index\n\t\n\tpackage github.com/cheikhshift/db\n\n## Interfaces\n\n### DB\n\ttype DB struct {\n\t\tMoDb *mgo.Database\n\t}\n\t\n### O\n\ttype O bson.M\n\t\n\n## Functions\n\n### Connect\nCreate a new database connection.\n\n\tfunc Connect(url string, db string) (DB,error)\n\n-url : MongoDb server URI to connect to.\n- db: database to use.\n\n\n## Close\n\nClose database connection.\n\n\tfunc (d DB) Close()\n\n### Validate\nVerify if model is valid. This [package](https://github.com/asaskevich/govalidator) is used for validation, Read more about supported types [here](https://github.com/asaskevich/govalidator).\n\n\tfunc (d DB) PreVerify(item interface{}) error\n\n- item : Model (struct) to verify.\n\n### Query\nMore information about mgo.Query [here](https://godoc.org/labix.org/v2/mgo#Query). Once your query is retrieved you may count ,limit, skip as you please.\n\n\tfunc (d DB) Query(item interface{}, query interface{}) *mgo.Query\n\n- item : Model to set query to.\n- query : `db.O`  map of parameters to query.\n\n\n### Add\nAdd the specified models to your database.\n\n\tfunc (d DB) Add(items ...interface{}) error {\n\n- items : models to save.\n\n### Save\nUpdate the model.\n\n\tfunc (d DB) Save(item interface{}) error\n\n\n- item : model to update.\n\n\n### Remove\nRemove model from database. If the model has no value for field Id this function will fail.\n\n\tfunc (d DB) Remove(items ...interface{}) error \n\n- items : items to remove.\n\n### RemoveAll\nRemove items via `db.O` query.\n\n\n\tfunc (d DB) RemoveAll(item interface{},query  interface{}) (*mgo.ChangeInfo,error)\n\n\n- item : model to set query to.\n- query :  map of parameters to query.\n\n### UpdateAll ...Save `All` \nUpdate models in your database via query.\n\n\tfunc (d DB) UpdateAll(item interface{},query interface{}, update interface{}) (*mgo.ChangeInfo,error) \n\n- item : model to set query to.\n- query : map of parameters to query.\n- update : map of updates to make. Remember to use MongoDb selections , ie : `$ne`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcheikhshift%2Fdb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcheikhshift%2Fdb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcheikhshift%2Fdb/lists"}