beautydate / hanami-gcloud-datastore Goto Github PK
View Code? Open in Web Editor NEW[WIP] Gcloud Datastore Adapter for Hanami::Model
License: MIT License
[WIP] Gcloud Datastore Adapter for Hanami::Model
License: MIT License
Way to use:
SELECT * FROM Kind WHERE __key__ HAS ANCESTOR KEY(Parent, '1')
Reference for future implementation.
In:
Based in documentation.
query do
where(activated: true).consistency(:strong)
# or
where(activated: true).consistency(:eventual)
end
My key is: Key(Subscription, '8565')
and datastore use name
(not id
).
SubscriptionRepository.find('8565').id # => nil
The current way to consume composite key is strange. We wait for new release of hanami adapter to improve!
Announcement: https://twitter.com/jodosha/status/732565329109516289
WIP but I found this error
Does not work as
in mapping, fields does not loaded.
# mapping
collection :subscriptions do
entity Subscription
repository SubscriptionRepository
attribute :id, Integer, as: :Id
attribute :schedule, String, as: :Schedule
end
I ran:
SubscriptionRepository.find('8565')
s # => #<Subscription:0x0055692cda4950 @id=nil @schedule=nil>
How we can develop composite keys using hanami "contract"? Can we use coercer like as this for key attribute?
Sample in ruby gcloud doc:
user_key = Gcloud::Datastore::Key.new "User", "alice"
task_list_key = Gcloud::Datastore::Key.new "TaskList", "default"
task_key = Gcloud::Datastore::Key.new "Task", "sampleTask"
task_list_key.parent = user_key
task_key.parent = task_list_key
dataset.find task_key
user_key = ['User', 'alice']
task_list_key = ['TaskList', 'default', { parent: user_key }]
task_key = ['Task', 'sampleTask', { parent: task_list_key }]
task = Task.new(id: task_key)
TaskRepository.persist(task)
It's possible implements first
and last
using:
# first
query = dataset.query('Subscription').order('__key__', :asc).limit(1)
dataset.run(query).first
# last
query = dataset.query('Subscription').order('__key__', :desc).limit(1)
dataset.run(query).first
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.