This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// WriteLog writes change log data into the file. | |
// A successful writing will return nil. | |
// When unable to write, an error will be returned. | |
func WriteLog(f *os.File, c ChangeLog) error |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* schema.go */ | |
// BuildSchema accepts build schema function(s) for applying to the schemabuilding.Schema object | |
func BuildSchema(buildSchemaFunc ...func(*schemabuilder.Schema)) (*graphql.Schema, error) { | |
s := schemabuilder.NewSchema() | |
for _, f := range buildSchemaFunc { | |
f(s) | |
} | |
return s.Build() | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"net/smtp" | |
"strings" | |
) | |
func main() { | |
s := NewNoAuthSender("localhost:25") | |
err := s.From("[email protected]"). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"encoding/json" | |
"github.com/go-chi/chi" | |
uuid "github.com/satori/go.uuid" | |
"log" | |
"math/rand" | |
"net/http" | |
"time" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"log" | |
"github.com/valyala/fasthttp" | |
) | |
func main() { | |
log.Println("fasthttp server is listening on :8080") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// The L293D output parameters for controlling DC motor. | |
// Each DC motor will be controled by 3 parameters which are | |
// PxA, PyA for sending high or low value and PxyEN for sending enable or disable value. | |
#define P1A 4 | |
#define P2A 5 | |
#define P12EN 8 | |
#define P3A 6 | |
#define P4A 7 | |
#define P34EN 9 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Money represents currency in Thai Baht | |
type Money float64 | |
// Employee is a person employed by a company | |
type Employee struct { | |
// An amount to-be paid per working hour | |
salaryPerHour Money | |
// A total number of working hours of the employee | |
workingHours int |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import "fmt" | |
type square struct { | |
width, height int | |
} | |
func main() { | |
s := square{width: 10, height: 10} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"context" | |
"database/sql" | |
"fmt" | |
_ "github.com/go-sql-driver/mysql" | |
"go.mongodb.org/mongo-driver/bson" | |
"go.mongodb.org/mongo-driver/mongo" | |
"go.mongodb.org/mongo-driver/mongo/options" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"context" | |
"fmt" | |
"math/rand" | |
"os" | |
"os/signal" | |
"sync" | |
"syscall" |
NewerOlder