gogun

package module
v0.0.0-...-8617cfe Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 3, 2019 License: MIT Imports: 6 Imported by: 0

README

gogun

Status / Features:

  • Idea design prototype
  • write/read file (simple test)
  • check dup (simple one part function)
  • radisk (not yet build)
  • radix (not yet build)
  • ham (not yet build)
  • store (simple test)
  • websocket (simple send / receive )

Information:

This is gun.go prototype port from gun.js. It is base on video on how to build gun database.

Link:

Golang is base on type struct and interface build as well different way to setup packages. Javascript and golang code language have different format. It coded in different way a bit. It will take a while to copy or clone gunjs in simple format.

main.go

package main

import (
	"fmt"
	"gogun"
)

func main() {

    fmt.Println("gun setup...")
    //this is just a test package.
    var Gun gogun.GunI = gogun.Gun{}
    Gun.Test()
    
}

Simple entry point to main

setup:

go get github.com/lightnet/gogun
go get github.com/lightnet/gohttpgunjs
msg["#"] // tricky to get '#' golang format
msg["_"] //

Json format will take a while to get part of the gun work in golang.

callback function setup differently a bit of challenge.

Notes:

  • Upper case first character letter is public function call.
  • Lower case first character letter is private function call.
  • There no class and constructor which will be hard to setup. That is different way to setup from information that I search around a bit. It work in progress test.
  • pacakge in group in files will able to call function to other ones that share if package is same location folder.
  • There is another gun golang version which seem be better. Link below.

@cretz github (WARNING: This is an early proof-of-concept alpha version. Many pieces are not implemented or don't work.)

Documentation

Overview

https://gowebexamples.com/websockets/ https://flaviocopes.com/go-date-time-format/ https://gowebexamples.com/json/ https://www.sohamkamani.com/blog/2017/10/18/parsing-json-in-golang/ https://stackoverflow.com/questions/14289256/cannot-convert-data-type-interface-to-type-string-need-type-assertion https://stackoverflow.com/questions/37011799/how-to-pass-a-child-struct-into-a-function-accepting-parent-struct

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WSEndpoint

func WSEndpoint(w http.ResponseWriter, r *http.Request)

=============================================== Web Server

Types

type Dup

type Dup struct {
	// contains filtered or unexported fields
}

type DupI

type DupI interface {
	// contains filtered or unexported methods
}

type Gun

type Gun []map[string]interface{}

https://forum.golangbridge.org/t/solved-map-string-interface-best-practice/5457

func (Gun) Get

func (g Gun) Get()

func (Gun) Map

func (g Gun) Map()

func (Gun) Once

func (g Gun) Once()

func (Gun) Put

func (g Gun) Put()

func (Gun) Test

func (g Gun) Test() string

func (Gun) ToJSON

func (g Gun) ToJSON()

type GunI

type GunI interface {
	Get()
	Map()
	Put()
	Once()
	ToJSON()
	Test() string
	// contains filtered or unexported methods
}

type InmemOpt

type InmemOpt struct {
	File string
}

func (InmemOpt) Get

func (o InmemOpt) Get() string

func (InmemOpt) Set

func (o InmemOpt) Set(value string)

type OptConfig

type OptConfig interface {
	Get() string
	Set(value string)
}

type Store

type Store struct {
	Opt OptConfig
}

func (Store) GetOpt

func (s Store) GetOpt()

type StoreI

type StoreI interface {
	GetOpt()
	// contains filtered or unexported methods
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL