{"id":16687066,"url":"https://github.com/paralin/cqlpb","last_synced_at":"2025-06-11T19:37:08.954Z","repository":{"id":152080407,"uuid":"60996414","full_name":"paralin/cqlpb","owner":"paralin","description":"Cassandra utilities and serialization in golang.","archived":false,"fork":false,"pushed_at":"2016-07-22T20:22:58.000Z","size":9,"stargazers_count":3,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-10T04:50:27.160Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/paralin.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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-06-13T00:38:56.000Z","updated_at":"2018-10-08T18:05:20.000Z","dependencies_parsed_at":"2023-09-16T04:53:25.731Z","dependency_job_id":null,"html_url":"https://github.com/paralin/cqlpb","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/paralin/cqlpb","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paralin%2Fcqlpb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paralin%2Fcqlpb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paralin%2Fcqlpb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paralin%2Fcqlpb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/paralin","download_url":"https://codeload.github.com/paralin/cqlpb/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paralin%2Fcqlpb/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259325551,"owners_count":22841057,"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-10-12T15:07:41.021Z","updated_at":"2025-06-11T19:37:08.927Z","avatar_url":"https://github.com/paralin.png","language":"Go","readme":"Cassandra Protobuf\n==================\n\nCassandra protobuf storage implementation in Go.\n\nMethodology\n===========\n\nThis code maps protobuf types to Cassandra schemas in the following migration-tolerant and intelligent way:\n\n - Every row has a field \"proto\" with a binary blob.\n - Row columns are automatically loaded into the proto after deserialization.\n - This allows some fields to be put into the schema, and others to remain binary only.\n\nDesign\n======\n\nThe design of this library is as follows:\n\n - Accept a protobuf message and a map (string-\u003einterface).\n - Fill the protobuf message with the \"proto\" field if it exists.\n - Fill the remaining fields with the cassandra columns.\n\nThe same goes the opposite direction for serialization.\n\n - Returns a map (string-\u003einterface)\n - Accept a protobuf message and a map (string-\u003einterface with zero-value)\n   - Map serves as a template for a cql row\n   - Map MUST contain \"proto\" field of type \"bytes\"\n   - Map MUST contain at least one other field, presumably used as ID\n - For each field in the map, check for a corresponding proto field\n   - If the names match but types do not, REFUSE to serialize (exit with error)\n - Serialize any corresponding field to cassandra field, and zero it in the protobuf\n   - proto3 does not store zeroed fields, this will save space\n - Serialize the protobuf to the proto field.\n\nUsage\n=====\n\nFirst, according to your schema, build a template map, for example:\n\n```go\ntemplate := make(map[string]interface{})\ntemplate[\"myStringVal\"] = \"\"\ntemplate[\"myIntVal\"] = int32(0)\ntemplate[\"myBoolVal\"] = false\ntemplate[\"proto\"] = make(0, []byte)\n```\n\nThe column names should match the names of the fields in your proto file.\n\nAny fields in your proto not specified in your template will be serialized in the \"proto\" field as a binary blob.\n\nYou can serialize a protobuf message to a cassandra map for insertion like so:\n\n```go\nmyMsg := \u0026MyMessage{MyStringVal: \"test\"}\nrow, err := marshal.Marshal(myMsg, template)\n```\n\nYou can then deserialize that row like so:\n\n```go\nmyMsg := \u0026MyMessage{}\nerr := marshal.Unmarshal(myMsg, row)\nmyMsg.MyStringVal == \"test\" // true\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fparalin%2Fcqlpb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fparalin%2Fcqlpb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fparalin%2Fcqlpb/lists"}