コード例 #1
0
import (
	"encoding/json"
	"fmt"
	"io/ioutil"
	"log"
	"net/http"
	"os"
	"sort"
	"strconv"
	"strings"

	"github.com/cagnosolutions/adb"
	"github.com/cagnosolutions/web"
)

var tmpl *web.TmplCache
var PDFPath = "upload/file/"
var db *adb.DB

// var db2 *repono.Client

func init() {
	db = adb.NewDB()
	// db2 = repono.Embed(repono.EmbedAndServeDB(":9999"))
	web.Funcs["split"] = func(s, sep string, i int) string {
		return strings.Split(s, sep)[i]
	}
	web.Funcs["json"] = func(v interface{}) string {
		b, err := json.Marshal(v)
		if err != nil {
			return ""
コード例 #2
0
ファイル: main.go プロジェクト: gregpechiro/lhb-go
	"path/filepath"
	"sort"
	"strconv"
	"strings"

	"github.com/cagnosolutions/dbdb"
	"github.com/cagnosolutions/web"
)

const (
	USERNAME = "******"
	PASSWORD = "******"
)

var mux = web.NewMux()
var tmpl *web.TmplCache
var db = dbdb.NewDataStore()

func init() {
	web.Funcs["split"] = func(s, sep string, i int) string {
		return strings.Split(s, sep)[i]
	}
	web.Funcs["title"] = strings.Title
	tmpl = web.NewTmplCache()
	db.AddStore("image")
	db.AddStore("listing")
}

func main() {

	mux.AddRoutes(home, gallery, about, contact, services, listings, floorPlans, login, logout)