text stringlengths 14 100k | source stringclasses 1
value | repo stringclasses 810
values | language stringclasses 13
values |
|---|---|---|---|
<|fim_prefix|>/// <ref<|fim_suffix|>ro/client" />
<|fim_middle|>erence path="../.astro/types.d.ts" />
/// <reference types="ast<|endoftext|> | fim | wailsapp/wails | typescript |
<|fim_suffix|>mposer.addSpan(20);
}
},
{
title: 'Gold Sponsors',
monthlyDollars: 200,
preset: gold,
composeAfter: function (composer, tierSponsors, config) {
composer.addSpan(20);
}
},
{
t... | fim | wailsapp/wails | javascript |
<|fim_suffix|>s
buildOptions.Logger.Println("%s", fmt.Sprintf("Built '%s' in %s.\n", compiledBinary, time.Since(start).Round(time.Millisecond).String()))
outputBinaries[buildOptions.Platform+"/"+buildOptions.Arch] = compiledBinary
} else {
pterm.Info.Println("Dry run: skipped build.")
}
})
if targetErr... | fim | wailsapp/wails | go |
<|fim_suffix|>com/wailsapp/wails/v2/internal/colour"
"github.com/wailsapp/wails/v2/pkg/clilogger"
)
func devApplication(f *flags.Dev) error {
if f.NoColour {
pterm.DisableColor()
colour.ColourEnabled = false
}
quiet := f.Verbosity == flags.Quiet
// Create logger
logger := clilogger.New(os.Stdout)
logger.M... | fim | wailsapp/wails | go |
<|fim_suffix|> + " - Optional Dependency")
}
dependenciesBox.Println(dependenciesTableString)
pterm.DefaultSection.Println("Diagnosis")
// Generate an appropriate diagnosis
if dependenciesAvailableRequired != 0 {
pterm.Println("Required package(s) installation details: \n" + info.Dependencies.InstallAllRequi... | fim | wailsapp/wails | go |
<|fim_suffix|>_, _ = fmt.Fprintf(w, "Obfuscated: \t%t\n", buildOptions.Obfuscated)
if buildOptions.Obfuscated {
_, _ = fmt.Fprintf(w, "Garble Args: \t%s\n", buildOptions.GarbleArgs)
}
_, _ = fmt.Fprintf(w, "Skip Frontend: \t%t\n", skipFrontend)
_, _ = fmt.Fprintf(w, "Compress: \t%t\n", buildOptions.Compress)
_, ... | fim | wailsapp/wails | go |
package flags
type BuildCommon struct {
LdFlags string `description:"Additional ldflags to pass to the compiler"`
Compiler string `description:"Use a different go compiler to build, eg go1.15beta1"`
SkipBindings bool `description:"Skips generation of bindings"`
RaceDetector bool `name:"rac... | fim | wailsapp/wails | go |
<|fim_suffix|>ut"`
}
<|fim_prefix|>packa<|fim_middle|>ge flags
type Common struct {
NoColour bool `description:"Disable colour in outp<|endoftext|> | fim | wailsapp/wails | go |
<|fim_prefix|>package flags
import (
"fmt"
"net"
"net/url"
"os"
"path/filepath"
"runtime"
"github.com/samber/lo"
"github.com/wailsapp/wails/v2/internal/project"
"github.com/wailsapp/wails/v2/pkg/commands/build"
)
type Dev struct {
BuildCommon
AssetDir string `flag:"assetdir" description:"Serv... | fim | wailsapp/wails | go |
<|fim_prefix|>package flags
type Doctor struct {
Co<|fim_suffix|>turn &Doctor{}
}
<|fim_middle|>mmon
}
func (b *Doctor) Default() *Doctor {
re<|endoftext|> | fim | wailsapp/wails | go |
<|fim_suffix|>te"`
Frontend string `description:"Frontend to use for the template"`
Quiet bool `description:"Suppress output"`
}
func (c *GenerateModule) Default() *GenerateModule {
return &GenerateModule{
Compiler: "go",
}
}
<|fim_prefix|>package flags
type GenerateModule struct {
Common
Compiler strin... | fim | wailsapp/wails | go |
<|fim_prefix|>package flags
type Init struct {
Common
TemplateName string `name:"t" description:"Name of built-in template to use, path to template or template url"`
ProjectName string `name:"n" description<|fim_suffix|>Mode"`
ProjectDir string `name:"d" description:"Project directory"`
Quiet bool `n... | fim | wailsapp/wails | go |
<|fim_prefix|>packag<|fim_suffix|>otes struct {
Common
Version string `description:"The version to show the release notes for"`
}
<|fim_middle|>e flags
type ShowReleaseN<|endoftext|> | fim | wailsapp/wails | go |
<|fim_prefix|>package flags
type Update struct {
Common
Version string `description:"The version to update to"`
PreReleas<|fim_suffix|> `name:"pre" description:"Update to latest pre-release"`
}
<|fim_middle|>e bool <|endoftext|> | fim | wailsapp/wails | go |
<|fim_prefix|>package main
import (
"fmt"
"os"
"path/filepath"
"github.com/leaanthony/debme"
"github.com/leaanthony/gosod"
"github.com/pterm/pterm"
"github.com/tidwall/sjson"
"github.com/wailsapp/wails/v2/cmd/wails/fl<|fim_suffix|> return err
}
pterm.DefaultSection.Println("Generating template")
if !emp... | fim | wailsapp/wails | go |
<|fim_suffix|>rintln("")
pterm.Printf("Initialised project '%s' in %s.\n", options.ProjectName, elapsed.Round(time.Millisecond).String())
pterm.Println("")
return nil
}
func initGit(options *templates.Options) error {
err := git.InitRepo(options.TargetDir)
if err != nil {
return errors.Wrap(err, "Unable to ini... | fim | wailsapp/wails | go |
<|fim_prefix|>package dev
import (
"context"
"errors"
"fmt"
"io"
"log"
"net/http"
"net/url"
"os"
"os/exec"
"os/signal"
"path"
"path/filepath"
"strings"
"sync"
"sync/atomic"
"syscall"
"time"
"github.com/samber/lo"
"github.com/wailsapp/wails/v2/cmd/wails/flags"
"github.com/wailsapp/wails/v2/cmd/wail... | fim | wailsapp/wails | go |
<|fim_prefix|>//go:build darwin || linux
// +build darwin linux
package dev
import (
"os/exec"
"syscall"
"github.com/wailsapp/wails/v2/cmd/wails/internal/logutils"
"golang.org/x/sys/unix"
)
func setParentGID(cmd <|fim_suffix|>Sur
// I'm using Vite, but I would imagine this could be an issue with Node (npm) in ... | fim | wailsapp/wails | go |
<|fim_suffix|>er bytes.Buffer
kill.Stderr = &errorBuffer
kill.Stdout = &stdoutBuffer
err := kill.Run()
if err != nil {
if err.Error() != "exit status 1" {
println(stdoutBuffer.String())
println(errorBuffer.String())
logutils.LogRed("Error from '%s': %s", devCommand, err.Error())
}
}
}
}
<|f... | fim | wailsapp/wails | go |
<|fim_prefix|>package dev
import (
"bufi<|fim_suffix|>TrimSpace(line), " ")
if strings.ToLower(s[0]) != "vite" {
return "", nil
}
if len(line) < 2 {
return "", fmt.Errorf("unable to parse vite version")
}
v := s[1]
if !semver.IsValid(v) {
return "", fmt.Errorf("%s is not a valid vite version string", v)... | fim | wailsapp/wails | go |
<|fim_prefix|>package dev
import (
"bufio"
"os"
"<|fim_suffix|>e {
Add(name string) error
}
// initialiseWatcher creates the project directory watcher that will trigger recompile
func initialiseWatcher(cwd, reloadDirs string) (*fsnotify.Watcher, error) {
// Ignore dot files, node_modules and build directories by... | fim | wailsapp/wails | go |
<|fim_suffix|>ting.T) {
// Create temporary file
err := fs.Mkdir("testdir")
require.NoError(t, err)
defer func() {
err := os.RemoveAll("testdir")
require.NoError(t, err)
}()
for _, file := range tt.files {
fs.MustWriteString(filepath.Join("testdir", file), "")
}
got := getIgnoreDirs... | fim | wailsapp/wails | go |
<|fim_suffix|>on)
}
}
if updated {
return os.WriteFile(gomodFilename, gomodData, 0o755)
}
return nil
}
func LogGreen(message string, args ...interface{}) {
text := fmt.Sprintf(message, args...)
println(colour.Green(text))
}
<|fim_prefix|>package gomod
import (
"fmt"
"os"
"strings"
"github.com/wailsap... | fim | wailsapp/wails | go |
<|fim_suffix|>essage) == 0 {
return
}
text := fmt.Sprintf(message, args...)
println(colour.DarkYellow(text))
}
<|fim_prefix|>package logutils
import (
"fmt"
"github.com/wailsapp/wails/v2/internal/colour"
)
func LogGreen(message string, args ...interface{}) {
if len(message) == 0 {
return
}
text := fmt.Sp... | fim | wailsapp/wails | go |
package main
import (
"context"
"fmt"
)
// App struct
type App struct {
ctx context.Context
}
// NewApp creates a new App application struct
func NewApp() *App {
return &App{}
}
// startup is called at application startup
func (a *App) startup(ctx context.Context) {
// Perform your setup here
a.ctx = ctx
}
/... | fim | wailsapp/wails | go |
<|fim_suffix|>ed base
var Base embed.FS
<|fim_prefix|>pack<|fim_middle|>age template
import (
"embed"
)
//go:emb<|endoftext|> | fim | wailsapp/wails | go |
<|fim_prefix|>package i<|fim_suffix|>ternal
import _ "embed"
//go:embed version.txt
var Version string
<|fim_middle|>n<|endoftext|> | fim | wailsapp/wails | go |
<|fim_prefix|>package main
import (
"fmt"
"os"
"strings"
"github.com/pterm/pterm"
"github.com/wailsapp/wails/v2/cmd/wails/internal"
"github.com/wailsapp/wails/v2/internal/colour"
"github.com/leaanthony/clir"
)
func banner(_ *clir.Cli) string {
return fmt.Sprintf("%s %s",
colour.Green("Wails CLI"),
colo... | fim | wailsapp/wails | go |
<|fim_suffix|>ails/v2/internal/colour"
"github.com/wailsapp/wails/v2/internal/github"
)
func showReleaseNotes(f *flags.ShowReleaseNotes) error {
if f.NoColour {
pterm.DisableColor()
colour.ColourEnabled = false
}
version := internal.Version
if f.Version != "" {
version = f.Version
}
app.PrintBanner()
r... | fim | wailsapp/wails | go |
package main
import (
"fmt"
"os"
"github.com/labstack/gommon/color"
"github.com/pterm/pterm"
"github.com/wailsapp/wails/v2/cmd/wails/flags"
"github.com/wailsapp/wails/v2/internal/colour"
"github.com/wailsapp/wails/v2/internal/shell"
"github.com/wailsapp/wails/v2/internal/github"
)
// AddSubcommand adds the ... | fim | wailsapp/wails | go |
<|fim_suffix|>App) Greet(name string) string {
return fmt.Sprintf("Hello %s, It's show time!", name)
}
<|fim_prefix|>package main
import (
"context"
"fmt"
)
// App struct
type App struct {
ctx context.Context
}
// NewApp creates a new App application struct
func NewApp() *App {
return &App{}
}
// sta<|fim_midd... | fim | wailsapp/wails | go |
<|fim_prefix|>package main
import (
"changeme/myfrontend"
"github.com/wailsapp/wails/v2"
"github.com/wailsapp/wails/v2/pkg/options"
)
func mai<|fim_suffix|>rr != nil {
println("Error:", err.Error())
}
}
<|fim_middle|>n() {
// Create an instance of the app structure
app := NewApp()
// Create application with... | fim | wailsapp/wails | go |
<|fim_suffix|>sets embed.FS
<|fim_prefix|>package myfrontend
import "embed"
//go:embed a<|fim_middle|>ll:dist
var As<|endoftext|> | fim | wailsapp/wails | go |
<|fim_prefix|>import './style.css';
import './app<|fim_suffix|>ult");
// Setup the greet function
window.greet = function () {
// Get name
let name = nameElement.value;
// Check if the input is empty
if (name === "") return;
// Call App.Greet(name)
try {
Greet(name)
.then(... | fim | wailsapp/wails | javascript |
<|fim_suffix|>ime!", name)
}
<|fim_prefix|>package main
import (
"context"
<|fim_middle|> "fmt"
)
// App struct
type App struct {
ctx context.Context
}
// NewApp creates a new App application struct
func NewApp() *App {
return &App{}
}
// startup is called when the app starts. The context is saved
// so we can c... | fim | wailsapp/wails | go |
<|fim_suffix|>(dropMessage) {
dropMessage.style.display = 'none';
}
dropZone.appendChild(droppedElement);
}
draggedItem = null;
});
// Add event listeners to file drop zone
fileDropZone.addEventListener('dragenter', (e) => {
e.preventDefault();
fileDropZone.classList.add('... | fim | wailsapp/wails | javascript |
<|fim_prefix|>// Cynhyr<|fim_suffix|>PEIDIWCH Â MODIWL
// This file is automatically generated. DO NOT EDIT
export function Greet(arg1:string):Promise<string>;
<|fim_middle|>chwyd y ffeil hon yn awtomatig. <|endoftext|> | fim | wailsapp/wails | typescript |
<|fim_prefix|>// @ts-check
// Cynhyrchwyd y ffeil hon yn a<|fim_suffix|>ndow['go']['main']['App']['Greet'](arg1);
}
<|fim_middle|>wtomatig. PEIDIWCH Â MODIWL
// This file is automatically generated. DO NOT EDIT
export function Greet(arg1) {
return wi<|endoftext|> | fim | wailsapp/wails | javascript |
<|fim_prefix|>/*
_ __ _ __
| | / /___ _(_) /____
| | /| / / __ `/ / / ___/
| |/ |/ / /_/ / / (__ )
|__/|__/\__,_/_/_/____/
The electron alternative for Go
(c) Lea Anthony 2019-present
*/
export interface Position {
x: number;
y: number;
}
export interface Size {
w: number;
h: number;
... | fim | wailsapp/wails | typescript |
<|fim_prefix|>/*
_ __ _ __
| | / /___ _(_) /____
| | /| / / __ `/ / / ___/
| |/ |/ / /_/ / / (__ )
|__/|__/\__,_/_/_/____/
The electron alternative for Go
(c) Lea Anthony 2019-present
*/
export function LogPrint(message) {
window.runtime.LogPrint(message);
}
export function LogTrace(message) {
<... | fim | wailsapp/wails | javascript |
package main
import (
"embed"
"github.com/wailsapp/wails/v2"
"github.com/wailsapp/wails/v2/pkg/options"
"github.com/wailsapp/wails/v2/pkg/options/assetserver"
)
//go:embed all:frontend/dist
var assets embed.FS
func main() {
// Create an instance of the app structure
app := NewApp()
// Create application wit... | fim | wailsapp/wails | go |
<|fim_prefix|>package main
import (
"context"
"fmt"
"time"
"g<|fim_suffix|>p application struct
func NewApp() *App {
return &App{}
}
// startup is called when the app starts. The context is saved
// so we can call the runtime methods
func (a *App) startup(ctx context.Context) {
a.ctx = ctx
}
// Greet returns ... | fim | wailsapp/wails | go |
<|fim_suffix|>== "") return;
// Call App.Greet(name)
try {
Greet(name)
.then((result) => {
// Update result with data back from App.Greet()
resultElement.innerText = result;
})
.catch((err) => {
console.error(err);
... | fim | wailsapp/wails | javascript |
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
// This file is automatically generated. DO NOT EDIT
export function Greet(arg1:string):Promise<string>;
<|endoftext|> | fim | wailsapp/wails | typescript |
<|fim_suffix|>DIWL
// This file is automatically generated. DO NOT EDIT
export function Greet(arg1) {
return window['go']['main']['App']['Greet'](arg1);
}
<|fim_prefix|>// @ts-check
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH <|fim_middle|>Â MO<|endoftext|> | fim | wailsapp/wails | javascript |
<|fim_prefix|>/*
_ __ _ __
| | / /___ _(_) /____
| | /| / / __ `/ / / ___/
| |/ |/ / /_/ / / (__ )
|__/|__/\__,_/_/_/____/
The electron alternative for Go
(c) Lea Anthony 2019-present
*/
export interface Position {
x: number;
y: number;
}
export interface Size {
w: number;
h: number;
... | fim | wailsapp/wails | typescript |
<|fim_prefix|>/*
_ __ _ __
| | / /___ _(_) /____
| | /| / / __ `/ / / ___/
| |/ |/ / /_/ / / (__ )
|__/|__/\__,_/_/_/____/
The electron alternative for Go
(c) Lea Anthony 2019-present
*/
export function LogPrint(message) {
window.runtime.LogPrint(message);
}
export function LogTrace(message) {
... | fim | wailsapp/wails | javascript |
<|fim_suffix|>undColour: &options.RGBA{R: 27, G: 38, B: 54, A: 1},
OnStartup: app.startup,
Bind: []interface{}{
app,
},
})
if err != nil {
println("Error:", err.Error())
}
}
<|fim_prefix|>package main
import (
"embed"
"github.com/wailsapp<|fim_middle|>/wails/v2"
"github.com/wailsapp/wails/v2/... | fim | wailsapp/wails | go |
<|fim_suffix|> *options.App
menuManager *menumanager.Manager
// Indicates if the app is in debug mode
debug bool
// Indicates if the devtools is enabled
devtoolsEnabled bool
// OnStartup/OnShutdown
startupCallback func(ctx context.Context)
shutdownCallback func(ctx context.Context)
ctx conte... | fim | wailsapp/wails | go |
<|fim_prefix|>//go:build bindings
package app
import (
"flag"
"os"
"path/filepath"
"github.com/leaanthony/gosod"
"github.com/wailsapp/wails/v2/internal/binding"
"github.com/wailsapp/wails/v2/internal/frontend/runtime/wrapper"
"github.com/wailsapp/wails/v2/internal/fs"
"github.com/wailsapp/wails/v2/internal/l... | fim | wailsapp/wails | go |
<|fim_prefix|>//go:build debug
packa<|fim_suffix|>unc IsDebug() bool {
return true
}
<|fim_middle|>ge app
f<|endoftext|> | fim | wailsapp/wails | go |
<|fim_suffix|>g() bool {
return false
}
<|fim_prefix|>//go:build !debug
package app
func IsDeb<|fim_middle|>u<|endoftext|> | fim | wailsapp/wails | go |
<|fim_suffix|>`Wails applications will not build without the correct build tags.`)
}
<|fim_prefix|>//go:build !dev && !production && !bindings && (linux || darwin)
package app
import (
"fmt"
"github.com/wailsapp/wails/v2/pkg/options"
)
func (a *App) Run() error {
return nil
}
// CreateApp creates the app!
func ... | fim | wailsapp/wails | go |
<|fim_prefix|>//go:build !dev && !production && !bindings && windows
package app
import (
"os/exec"
"github.com/wailsapp/wails/v2/internal/frontend/desktop/windows/winc/w32"
"github.com/wailsapp/wails/v2<|fim_suffix|>essageBox(0,
`Wails applications will not build without the correct build tags.
Please use "wa... | fim | wailsapp/wails | go |
<|fim_suffix|>
desktopFrontend := desktop.NewFrontend(ctx, appoptions, myLogger, appBindings, messageDispatcher)
appFrontend := devserver.NewFrontend(ctx, appoptions, myLogger, appBindings, messageDispatcher, menuManager, desktopFrontend)
eventHandler.AddFrontend(appFrontend)
eventHandler.AddFrontend(desktopFronten... | fim | wailsapp/wails | go |
<|fim_suffix|>
package app
// Note: devtools flag is also added in debug builds
func IsDevtoolsEnabled() bool {
return true
}
<|fim_prefix|>//go:build devtools<|fim_middle|>
<|endoftext|> | fim | wailsapp/wails | go |
<|fim_prefix|>//go:build !devtools
package ap<|fim_suffix|>d in debug builds
func IsDevtoolsEnabled() bool {
return false
}
<|fim_middle|>p
// IsDevtoolsEnabled returns true if devtools should be enabled
// Note: devtools flag is also adde<|endoftext|> | fim | wailsapp/wails | go |
<|fim_prefix|>//go:build obfuscated
p<|fim_suffix|>
<|fim_middle|>ackage app
// IsObfuscated returns true if the obfuscated build tag is set
func IsObfuscated() bool {
return true
}<|endoftext|> | fim | wailsapp/wails | go |
//go:build !obfuscated
package app
// IsObfuscated returns false if the obfuscated build tag is not set
func IsObfuscated() bool {
return false
}
<|endoftext|> | fim | wailsapp/wails | go |
<|fim_prefix|>//go:build (linux || darwin) && !bindings
package app
import (
"github.com/wailsapp/wails/v2/internal/logger"
"github.com/wailsapp/wails/v2/pkg/options"
)
func PreflightChecks(_ *options.App, _ *logg<|fim_suffix|>Logger) error {
return nil
}
<|fim_middle|>er.<|endoftext|> | fim | wailsapp/wails | go |
<|fim_suffix|>stalledVersion, err := wv2installer.Process(options)
if installedVersion != "" {
logger.Debug("WebView2 Runtime Version '%s' installed. Minimum version required: %s.",
installedVersion, wv2installer.MinimumRuntimeVersion)
}
if err != nil {
return err
}
return nil
}
<|fim_prefix|>//go:build wi... | fim | wailsapp/wails | go |
<|fim_suffix|>s)
debug := IsDebug()
devtoolsEnabled := IsDevtoolsEnabled()
ctx = context.WithValue(ctx, "debug", debug)
ctx = context.WithValue(ctx, "devtoolsEnabled", devtoolsEnabled)
// Set up logger
myLogger := logger.New(appoptions.Logger)
if IsDebug() {
myLogger.SetLogLevel(appoptions.LogLevel)
} else ... | fim | wailsapp/wails | go |
<|fim_suffix|>nd() == reflect.Struct {
fqname := fType.String()
sNameSplit := strings.SplitN(fqname, ".", 2)
if len(sNameSplit) < 2 {
continue
}
sName := sNameSplit[1]
pName := getPackageName(fqname)
a := reflect.New(fType)
if b.hasExportedJSONFields(fType) {
s := reflect.Indir... | fim | wailsapp/wails | go |
<|fim_suffix|>classs));
} else if ("object" === typeof a) {
if (asMap) {
for (const key of Object.keys(a)) {
a[key] = new classs(a[key]);
}
return a;
}
return new classs(a);
}
return a;
}
}
}
`,
}
<|fim_prefix|>package binding_test
type StructWithAnonymousSubMultiLevelStru... | fim | wailsapp/wails | go |
<|fim_suffix|> any, classs: any, asMap: boolean = false): any {
if (!a) {
return a;
}
if (a.slice && a.map) {
return (a as any[]).map(elem => this.convertValues(elem, classs));
} else if ("object" === typeof a) {
if (asMap) {
for (const key of Object.keys(a)) {
a[key] = new classs(a[k... | fim | wailsapp/wails | go |
package binding_test
import (
"io/fs"
"os"
"testing"
"github.com/wailsapp/wails/v2/internal/binding"
"github.com/wailsapp/wails/v2/internal/binding/binding_test/binding_test_import/float_package"
"github.com/wailsapp/wails/v2/internal/binding/binding_test/binding_test_import/int_package"
"github.com/wailsapp/w... | fim | wailsapp/wails | go |
<|fim_prefix|>package binding_test
// Issues 2303, 3442, 370<|fim_suffix|>rray<Array<number>>>;
DoubleArrayMap2: Record<string, Array<Array<number>>>;
DoubleArrayMap3: Record<string, Array<Array<number>>>;
OneStructs: DeepMessage[];
TwoStr... | fim | wailsapp/wails | go |
<|fim_suffix|>key of Object.keys(a)) {
a[key] = new classs(a[key]);
}
return a;
}
return new classs(a);
}
return a;
}
}
}
`,
}
<|fim_prefix|>package binding_test
type EmptyStruct struct {
Empty struct{} `json:"empty"`
}
func (s EmptyStruct) Get() EmptyStruct {
return s
}
var EmptyS... | fim | wailsapp/wails | go |
<|fim_suffix|> }
}
}
`,
}
<|fim_prefix|>package binding_test
// Test for PR #4664: Fix generated enums ordering
// This test ensures that enum output is deterministic regardless of map iteration order
// ZFirstEnum - named with Z prefix to test alphabetical sorting
type ZFirstEnum int
const (
ZFirstEnumValue1... | fim | wailsapp/wails | go |
<|fim_prefix|>package binding_test
type EscapedName struct {
Name string `json:"n.a.m.e"`
}
func (s EscapedName) Get() EscapedName {
return s
}
var EscapedNameTest = BindingTest{
name: "EscapedName",
structs: []interface{}{
&EscapedName{},
},
exemptions: nil,
shouldError: false,
want: `
export namespace b... | fim | wailsapp/wails | go |
package binding_test
import "github.com/wailsapp/wails/v2/internal/binding/binding_test/binding_test_import/float_package"
// Issues 3900, 3371, 2323 (no TS generics though)
type ListData[T interface{}] struct {
Total int64 `json:"Total"`
TotalPage int64 `json:"TotalPage"`
PageNum int `json:"PageNum"`
Li... | fim | wailsapp/wails | go |
<|fim_suffix|>
}
`,
}
<|fim_prefix|>packag<|fim_middle|>e binding_test
import (
"unsafe"
)
// Issues 3755, 3809
type Ignored struct {
Valid bool
Total func() int `json:"Total"`
UnsafeP unsafe.Pointer
Complex64 complex64 `json:"Complex"`
Complex128 complex128
StringChan chan string
... | fim | wailsapp/wails | go |
<|fim_prefix|>package binding_test
import "github.com/wailsapp/wails/v2/internal/binding/binding_test/binding_test_import"
type ImportedEnumStruct struct {
EnumValue binding_test_import.ImportedEnum `json:"EnumValue"`
}
func (s ImportedEnumStruct) Get() ImportedEnumStruct {
return s
}
var Imported<|fim_suffix|>te... | fim | wailsapp/wails | go |
<|fim_suffix|>.map(elem => this.convertValues(elem, classs));
} else if ("object" === typeof a) {
if (asMap) {
for (const key of Object.keys(a)) {
a[key] = new classs(a[key]);
}
return a;
}
return new classs(a);
}
return a;
}
}
}
export namespace binding_test_nestedimport {... | fim | wailsapp/wails | go |
<|fim_prefix|>package binding_test
import "github.com/wailsapp/wails/v2/internal/binding/binding_test/binding_test_import"
type ImportedSlice struct {
ASliceWrapperContainer binding_test_import.ASliceWrapper `json:"ASliceWrapperContainer"`
}
func (s ImportedSlice) Get() ImportedSlice {
return s
}
var ImportedSlic... | fim | wailsapp/wails | go |
<|fim_prefix|>package binding_test
import "github.com/wailsapp/wails/v2/internal/binding/binding_test/binding_test_import"
type ImportedStruct struct {
AWrapperCont<|fim_suffix|>ring;
static createFrom(source: any = {}) {
return new A(source);
}
constructor(source: any = {}) {
if ('string' === typeof sou... | fim | wailsapp/wails | go |
<|fim_suffix|>}) {
return new Multistruct3(source);
}
constructor(source: any = {}) {
if ('string' === typeof source) source = JSON.parse(source);
this.name = source["name"];
}
}
export class Multistruct4 {
name: string;
static createFrom(source: any = {}) {
return new Multistruct4(source);
}
... | fim | wailsapp/wails | go |
<|fim_suffix|>eturn a;
}
return new classs(a);
}
return a;
}
}
}
`,
}
<|fim_prefix|>package binding_test
type As struct {
B Bs `json:"b"`
}
type Bs struct {
Name string `json:"name"`
}
func (a As) Get() As {
return a
}
var NestedFieldTest = BindingTest{
name: "NestedField",
structs: []interfac... | fim | wailsapp/wails | go |
<|fim_prefix|>package binding_test
type NonStringMapKey struct {
NumberMap map[uint]any `json:"numberMap"`
}
func (s NonStringMapKey) Get() NonStringMapKey {
return s
}
var NonStringMapKeyTest = BindingTest{
name: "NonStringMapKey",
structs: []interface{}{
&NonStringMapKey{},
},
exemptions: nil,
shouldErro... | fim | wailsapp/wails | go |
<|fim_suffix|>nc (n NoFieldTags) Get() NoFieldTags {
return n
}
var NoFieldTagsTest = BindingTest{
name: "NoFieldTags",
structs: []interface{}{
&NoFieldTags{},
},
exemptions: nil,
shouldError: false,
want: `
export namespace binding_test {
export class NoFieldTags {
Name: string;
Address: string;
Zip?... | fim | wailsapp/wails | go |
<|fim_prefix|>package binding_test
import (
"io/fs"
"os"
"testing"
"github.com/wailsapp/wails/v2/internal/binding"
"github.com/wailsapp/wails/v2/internal/logger"
)
const expectedPromiseBindings = `// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
// This file is automatically generated. DO NOT EDIT
imp... | fim | wailsapp/wails | go |
<|fim_suffix|>{
name: string;
static createFrom(source: any = {}) {
return new SingleField(source);
}
constructor(source: any = {}) {
if ('string' === typeof source) source = JSON.parse(source);
this.name = source["name"];
}
}
}
`,
}
<|fim_prefix|>package binding_te<|fim_middle|>st
type SingleField... | fim | wailsapp/wails | go |
<|fim_suffix|> if ('string' === typeof source) source = JSON.parse(source);
}
}
}`,
}
<|fim_prefix|>package binding_test
type WithoutFields struct {
}
func (s WithoutFields) Get() WithoutFields {
return s
}
var WithoutFieldsTest = BindingTest{
name: "StructWit... | fim | wailsapp/wails | go |
<|fim_prefix|>package binding_test
import (
"reflect"
"strings"
"testing"
"github.com/stretchr/testify/require"
"github.com/wailsapp/wails/v2/internal/binding"
"github.com/wailsapp/wails/v2/internal/logger"
)
type BindingTest struct {
name string
structs []interface{}
enums []interface{}
e... | fim | wailsapp/wails | go |
<|fim_suffix|>nestedimport.A `json:"ASlice"`
}
type AMapWrapper struct {
AMap map[string]binding_test_nestedimport.A `json:"AMap"`
}
type ImportedEnum string
const (
ImportedEnumValue1 ImportedEnum = "value1"
ImportedEnumValue2 ImportedEnum = "value2"
ImportedEnumValue3 ImportedEnum = "value3"
)
var AllImported... | fim | wailsapp/wails | go |
<|fim_prefix|>package bindi<|fim_suffix|><|fim_middle|>ng_test_nestedimport
type A struct {
A string `json:"A"`
}
<|endoftext|> | fim | wailsapp/wails | go |
<|fim_suffix|>tring `json:"string"`
}
<|fim_prefix|>package float_package
type SomeStruct struct {
Name<|fim_middle|> s<|endoftext|> | fim | wailsapp/wails | go |
<|fim_prefix|>pack<|fim_suffix|>ruct struct {
Name string `json:"string"`
}
<|fim_middle|>age int_package
type SomeSt<|endoftext|> | fim | wailsapp/wails | go |
package map_package
type SomeStruct struct {
Name string `json:"string"`
}
<|endoftext|> | fim | wailsapp/wails | go |
<|fim_prefix|>package uint_package
type SomeStruct struct {<|fim_suffix|> Name string `json:"string"`
}
<|fim_middle|>
<|endoftext|> | fim | wailsapp/wails | go |
<|fim_suffix|>X {
name: string;
enum: MY_PREFIX_IntEnum_MY_SUFFIX;
static createFrom(source: any = {}) {
return new MY_PREFIX_EntityWithIntEnum_MY_SUFFIX(source);
}
constructor(source: any = {}) {
if (... | fim | wailsapp/wails | go |
package binding_test
import (
"github.com/wailsapp/wails/v2/internal/binding/binding_test/binding_test_import/int_package"
"io/fs"
"os"
"testing"
"github.com/wailsapp/wails/v2/internal/binding"
"github.com/wailsapp/wails/v2/internal/logger"
)
const expectedTypeAliasBindings = `// Cynhyrchwyd y ffeil hon yn awt... | fim | wailsapp/wails | go |
<|fim_prefix|>package binding_test
type SpecialCharacterField struct {
ID string `json:"@ID,omitempty"`
}
func (s SpecialCharacterField) Get() SpecialCharacterField {
return <|fim_suffix|>`,
}
<|fim_middle|>s
}
var SpecialCharacterFieldTest = BindingTest{
name: "SpecialCharacterField",
structs: []interface{}{
... | fim | wailsapp/wails | go |
<|fim_prefix|>package binding
import (
"encoding/json"
"fmt"
"reflect"
)
type BoundedMethodPath struct {
Package string
Struct stri<|fim_suffix|>ac
}
}
case 2:
returnValue = callResults[0].Interface()
if temp, ok := callResults[1].Interface().(error); ok {
err = temp
}
}
return returnValue, er... | fim | wailsapp/wails | go |
<|fim_suffix|>.lock.RUnlock()
return d.methodMap[qualifiedMethodName]
}
// GetObfuscatedMethod returns the method for the given ID
func (d *DB) GetObfuscatedMethod(id int) *BoundMethod {
// Lock the db whilst processing and unlock on return
d.lock.RLock()
defer d.lock.RUnlock()
if len(d.obfuscatedMethodArray) <... | fim | wailsapp/wails | go |
<|fim_prefix|>package binding
import (
"bytes"
_ "embed"
"fmt"
"os"
"path/filepath"
"regexp"
"sort"
"strings"
"github.com/wailsapp/wails/v2/internal/fs"
"github.com/leaanthony/slicer"
)
var (
mapRegex *regexp.Regexp
keyPackageIndex int
keyTypeIndex int
valueArrayIndex int
valuePacka... | fim | wailsapp/wails | go |
<|fim_suffix|>ric",
input: "main.ListData[*net/http.Request]",
want: "main.ListData_net_http_Request_",
},
}
var importNamespaces slicer.StringSlicer
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got := goTypeToJSDocType(tt.input, &importNamespaces); got != tt.want {
t.Errorf("g... | fim | wailsapp/wails | go |
<|fim_suffix|>l {
return p.TypeName == typename
}
// IsError returns true if the parameter type is an error
func (p *Parameter) IsError() bool {
return p.IsType("error")
}
<|fim_prefix|>package binding
import "reflect"
// Parameter defines a Go method parameter
type Parameter struct {
Name string `json:"na... | fim | wailsapp/wails | go |
<|fim_suffix|>.Name()
packageName := getPackageName(thisOutput.String())
b.AddStructToGenerateTS(packageName, name, s)
}
outputs = append(outputs, thisParam)
}
boundMethod.Outputs = outputs
// Save method in result
result = append(result, boundMethod)
}
return result, nil
}
func getPackageNa... | fim | wailsapp/wails | go |
<|fim_suffix|>egroundBrightMagenta, text)
}
func White(text string) string {
if !ColourEnabled {
return text
}
return Col(ctc.ForegroundBrightWhite, text)
}
func Black(text string) string {
if !ColourEnabled {
return text
}
return Col(ctc.ForegroundBrightBlack, text)
}
func DarkYellow(text string) string {... | fim | wailsapp/wails | go |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.