Comments (6)
@rashadg1030 We don't need FromJSON
instance. Regarding the problem with ToJSON
instance: you can store a plain list of values inside the Issue
data type and wrap it in PGArray
only in the ToRow/FromRow
instances. This means that you cannot derive those instances automatically, you need to write them manually. But what can be done... You either need to write manual JSON or Row instances. And let's not have orphan instances. Manual wrapping and unwrapping is better for the maintainability.
from issue-wanted.
Is there a ToRow
/FromRow
instance for type [a]
, or do I have to roll my own? The Issue
type has a labels :: [Text]
field. How do we get this to an SQL array?
from issue-wanted.
https://www.stackage.org/haddock/nightly-2019-06-27/postgresql-simple-0.6.2/Database-PostgreSQL-Simple-Types.html
I think I found something newtype PGArray a
from issue-wanted.
@rashadg1030 Yes, for arrays you need to use PGArray
newtype
from issue-wanted.
@chshersh Okay so Issue
now has a PGArray Text
field. I have a ToJSON
instance for Issue
. I'm trying to roll the FromJSON
instance, but I was thinking if we even need an instance because we're using the github
api. Maybe we still need it for something else though
from issue-wanted.
instance (ToJSON a) => ToJSON (PGArray a) where
toJSON :: PGArray a -> Value
toJSON = toJSON . fromPGArray
I get an orphan instance warning. It's telling me to either:
move the instance declaration to the module of the class or of the type, or
wrap the type with a newtype and declare the instance on the new type.
from issue-wanted.
Related Issues (20)
- Implement proper pagination HOT 2
- Wire up pagination on frontend
- Buy cool domain name HOT 3
- Figure out how to deploy this project
- Consider using named parameters in queries HOT 4
- Add `repoDefaultBranch` field to `Repo` type HOT 2
- Update README HOT 3
- Decide on how we want to model filtering issues and repos HOT 2
- Decide on sync scheduling strategy
- Implement function for fetching repos page by page
- Handle API rate limit more gracefully when syncing
- Think how to speed up syncing HOT 3
- Endpoint to get all labels
- Endpoint to get all categories
- Tables for labels and categories? HOT 6
- Add frontend check to CI
- Bump up to lts-14.* resolver
- Endpoint should return non-polymorphic data types HOT 2
- Update docker info docs
- Push docker image on docker hub HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from issue-wanted.