[web-devel] [Yesod] How to write a field as binary data column.

Felipe Almeida Lessa felipe.lessa at gmail.com
Mon Dec 27 04:41:27 CET 2010


2010/12/27 いとうかつとし <cutsea110 at gmail.com>:
> Hi
> I'm planning store files (ie. images, excel ...) into database.
> how to write this?

Just use a ByteString as your data type! =)

For example:

import Yesod
import Data.ByteString (ByteString)
import Database.Persist.Base
import Database.Persist.TH (share2)
import Database.Persist.GenericSql (mkMigrate)

share2 mkPersist (mkMigrate "migrateAll") [$persist|
User
    ident String
    password String
    photo ByteString
|]

Hope that helps,

-- 
Felipe.



More information about the web-devel mailing list