Comments (3)
I haven't tested if this works at all, but my first guess would be something like this
import Database.Esqueleto.Internal.Internal (unsafeSqlFunction, SqlExpr(..), noMeta, valueToFunctionArg)
mysqlGroupConcat ::
PersistField a
=> SqlExpr (Value a)
-> SqlExpr (Value a)
-> SqlExpr (Value Text)
mysqlGroupConcat expr sep =
ERaw noMeta $ \_ info ->
let (tlbExpr, _) = valueToFunctionArg info expr
(tlbSep, valSep) = valueToFunctionArg info sep
in ("GROUP_CONCAT(" <> tlbExpr <> " SEPARATOR '" <> tlbSep <> "')", valSep)
from espial.
Hi,
many thanks for your help. I had to change the code a bit. It compiled successfully. But when starting the web server, mysql issued an error message because of a wrong syntax. This is the code that worked for me:
mysqlGroupConcat ::
PersistField a
=> SqlExpr (Value a)
-> SqlExpr (Value Text)
mysqlGroupConcat expr =
ERaw noMeta $ \_ info ->
let (tlbExpr, yx) = valueToFunctionArg info expr
in ("GROUP_CONCAT(" <> tlbExpr <> " SEPARATOR ' ' )", yx)
I also found out why your query doesn't yield any results. It's because of the like-operator. But when performing a simple query of your database using the Mysql workbench it works. So I had to use the match against function for fulltext search in mysql. As for the match against function your code was really helpful. And now it's working.
from espial.
Excellent - glad you got it working
from espial.
Related Issues (20)
- Builds or Docker images for arm/aarch64 architectures HOT 1
- Archive and Full-text search HOT 2
- Documentation? HOT 8
- Found a possible security concern HOT 2
- Support importing Netscape Bookmarks file format HOT 1
- Ability to archive individual entries
- Description field value type HOT 4
- Publish latest release to Hackage? HOT 2
- Invalid URL HOT 5
- automatically bookmark pages annotated with hypothes HOT 2
- Question: Import with Archive HOT 2
- RSS feed always proposes all content instead of tags in use HOT 1
- Move tmp directory out of static
- Add SIGTERM handler to shut down cleanly HOT 3
- Make tag cloud available for public users HOT 4
- A new Hackage release HOT 5
- Public vs Private HOT 2
- XSRF errors on login with docker compose HOT 4
- Is this project still active? HOT 1
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 espial.