<commit_before>mysqlstore
==========

Gorilla's Session Store Implementation for MySQL

Installation
===========

Run `go get github.com/srinathgs/mysqlstore` from command line. Gets installed in `$GOPATH`

Usage
=====

`NewMysqlStore` takes the following paramaters

    endpoint - A sql.Open style endpoint
    tableName - table where sessions are to be saved. Required fields are created automatically if the table doesnot exist.
    path - path for Set-Cookie header
    maxAge 
    codecs

Internally, `mysqlstore` uses [this](https://github.com/go-sql-driver/mysql) MySQL driver.

e.g.,
      

      package main
  
      import (
  	    "fmt"
  	    "github.com/srinathgs/mysqlstore"
  	    "net/http"
      )
  
      var store, _ = mysqlstore.NewMySQLStore("UN:PASS@tcp(<IP>:<PORT>)/<DB>?parseTime=true&loc=Local", <tablename>, "/", 3600, []byte("<SecretKey>"))
      defer store.Close()
  
      func sessTest(w http.ResponseWriter, r *http.Request) {
  	    session, err := store.Get(r, "foobar")
  	    session.Values["bar"] = "baz"
  	    session.Values["baz"] = "foo"
  	    err = session.Save(r, w)
  	    fmt.Printf("%#v\n", session)
  	    fmt.Println(err)
      }

    func main() {
    	http.HandleFunc("/", sessTest)
    	http.ListenAndServe(":8080", nil)
    }<commit_msg>Example fixed so that it will compile: defer inside function & catch err (#13)<commit_after>mysqlstore
==========

Gorilla's Session Store Implementation for MySQL

Installation
===========

Run `go get github.com/srinathgs/mysqlstore` from command line. Gets installed in `$GOPATH`

Usage
=====

`NewMysqlStore` takes the following paramaters

    endpoint - A sql.Open style endpoint
    tableName - table where sessions are to be saved. Required fields are created automatically if the table doesnot exist.
    path - path for Set-Cookie header
    maxAge 
    codecs

Internally, `mysqlstore` uses [this](https://github.com/go-sql-driver/mysql) MySQL driver.

e.g.,
      

      package main
  
      import (
  	    "fmt"
  	    "github.com/srinathgs/mysqlstore"
  	    "net/http"
      )
  
      var store *mysqlstore.MySQLStore
  
      func sessTest(w http.ResponseWriter, r *http.Request) {
  	    session, err := store.Get(r, "foobar")
  	    session.Values["bar"] = "baz"
  	    session.Values["baz"] = "foo"
  	    err = session.Save(r, w)
  	    fmt.Printf("%#v\n", session)
  	    fmt.Println(err)
      }

    func main() {
        store, err := mysqlstore.NewMySQLStore("UN:PASS@tcp(<IP>:<PORT>)/<DB>?parseTime=true&loc=Local", <tablename>, "/", 3600, []byte("<SecretKey>"))
        if err != nil {
          panic(err)
        }
        defer store.Close()

    	http.HandleFunc("/", sessTest)
    	http.ListenAndServe(":8080", nil)
    }
{'fraction_non_alphanumeric': 0.14322064703744092, 'fraction_numerical': 0.006543075245365322, 'mean_word_length': 2.8169209431345354, 'pattern_counts': {'":': 2, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1902706', 'n_tokens_mistral': 953, 'n_tokens_neox': 898, 'n_words': 221}