github.com/gocaveman/caveman@v0.0.0-20191211162744-0ddf99dbdf6e/dbutil/file2sqlite/file2sqlite.go (about)

     1  // Tooling to take flat files and synchronize them with a sqlite database for easy access use of
     2  // large amounts of static data, generally versioned with the website project.
     3  package file2sqlite
     4  
     5  // developer provides a struct, can be unmarshaled from yaml or json or other
     6  // struct also maps to db columns - using sqlx
     7  // one way is one file per record
     8  // another is one file with an array with a bunch of records
     9  // either way it loads into in mrmory or tempfile sqlite db and then becomes
    10  // queryable with sqlx
    11  // the idea is it gets run at startup and you can make flat files into db
    12  // tables easily
    13  // optional writing allows writes to update sqlite and also update backing file
    14  // - see if there's a way to do this transparently but don't die over it -
    15  //   think through how this would be used with a controller; maybe deserving
    16  //   of some template generation stuff
    17  // think about how this works with the page index - will scan view files
    18  // reading the meta blocks and index them in a table like this - will need
    19  // to be able to customize that; and then use the same approach as if
    20  // things were fully database driven - this means that we probably don't
    21  // want to mix and match ORMs - using the same one here will help us a lot;
    22  // or possibly this package works completely with database/sql and/or sqlx
    23  // but then if someone uses a gorm object on top of it that will work just
    24  // fine - that could work well too